mirror of
https://github.com/httprunner/httprunner.git
synced 2026-08-28 11:36:56 +08:00
test: Reset redirect in teardown
This commit is contained in:
+3
-2
@@ -11,12 +11,14 @@ class TestCli(unittest.TestCase):
|
|||||||
self.captured_output = io.StringIO()
|
self.captured_output = io.StringIO()
|
||||||
sys.stdout = self.captured_output
|
sys.stdout = self.captured_output
|
||||||
|
|
||||||
|
def tearDown(self):
|
||||||
|
sys.stdout = sys.__stdout__ # Reset redirect.
|
||||||
|
|
||||||
def test_show_version(self):
|
def test_show_version(self):
|
||||||
sys.argv = ["hrun", "-V"]
|
sys.argv = ["hrun", "-V"]
|
||||||
|
|
||||||
with self.assertRaises(SystemExit) as cm:
|
with self.assertRaises(SystemExit) as cm:
|
||||||
main()
|
main()
|
||||||
sys.stdout = sys.__stdout__ # Reset redirect.
|
|
||||||
|
|
||||||
self.assertEqual(cm.exception.code, 0)
|
self.assertEqual(cm.exception.code, 0)
|
||||||
|
|
||||||
@@ -28,7 +30,6 @@ class TestCli(unittest.TestCase):
|
|||||||
|
|
||||||
with self.assertRaises(SystemExit) as cm:
|
with self.assertRaises(SystemExit) as cm:
|
||||||
main()
|
main()
|
||||||
sys.stdout = sys.__stdout__ # Reset redirect.
|
|
||||||
|
|
||||||
self.assertEqual(cm.exception.code, 0)
|
self.assertEqual(cm.exception.code, 0)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user