diff --git a/src/tests/test_overall.py b/src/tests/test_overall.py --- a/src/tests/test_overall.py +++ b/src/tests/test_overall.py @@ -10,6 +10,7 @@ import config from hashtree import HashTree from client import Client, Connection as ClientConnection from server import Miniserver +from . import RedirectedOutput config.logger.removeHandler(config.handler) @@ -31,23 +32,17 @@ def compareFiles(f1,f2): return (h,h2) -class TestMorevna(TestCase): +class TestMorevna(RedirectedOutput,TestCase): _stdout=None - @classmethod - def setUpClass(cls): - cls._stdout=sys.stdout - sys.stdout=open("/tmp/morevna-stdout.log",mode="a") - def setUp(self): src=os.path.join(dataDir,"test1.img") shutil.copyfile(src,filename) @classmethod def tearDownClass(cls): + super().tearDownClass() os.remove(filename) - sys.stdout.close() - sys.stdout=cls._stdout def test_build(self): treeFile=os.path.join(dataDir,"test.bin")