make tests python2 compat

This commit is contained in:
Edwin Eefting
2020-07-08 17:53:54 +02:00
parent a6cdd4b89e
commit f2b284c407
3 changed files with 39 additions and 9 deletions

View File

@ -1,7 +1,6 @@
from basetest import *
import contextlib
import io
class TestZfsNode(unittest2.TestCase):
@ -32,9 +31,10 @@ class TestZfsNode(unittest2.TestCase):
r=shelltest("rm /test_target1/waste")
r=shelltest("zfs umount test_target1")
#should resume and succeed
with io.StringIO() as buf:
with contextlib.redirect_stdout(buf):
with OutputIO() as buf:
with redirect_stdout(buf):
with patch('time.strftime', return_value="20101111000002"):
self.assertFalse(ZfsAutobackup("test test_target1 --verbose --allow-empty".split(" ")).run())