From afccf1e5f88b385db278c4a2d4385566e758a627 Mon Sep 17 00:00:00 2001 From: debugtalk Date: Wed, 25 Dec 2019 22:36:17 +0800 Subject: [PATCH] test: Reset redirect in teardown --- tests/test_cli.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/test_cli.py b/tests/test_cli.py index df19a110..33914844 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -11,12 +11,14 @@ class TestCli(unittest.TestCase): self.captured_output = io.StringIO() sys.stdout = self.captured_output + def tearDown(self): + sys.stdout = sys.__stdout__ # Reset redirect. + def test_show_version(self): sys.argv = ["hrun", "-V"] with self.assertRaises(SystemExit) as cm: main() - sys.stdout = sys.__stdout__ # Reset redirect. self.assertEqual(cm.exception.code, 0) @@ -28,7 +30,6 @@ class TestCli(unittest.TestCase): with self.assertRaises(SystemExit) as cm: main() - sys.stdout = sys.__stdout__ # Reset redirect. self.assertEqual(cm.exception.code, 0)