summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Lib/unittest/test/test_runner.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/Lib/unittest/test/test_runner.py b/Lib/unittest/test/test_runner.py
index 8f5cd2e..5a91f1b 100644
--- a/Lib/unittest/test/test_runner.py
+++ b/Lib/unittest/test/test_runner.py
@@ -137,6 +137,18 @@ class TestCleanUp(unittest.TestCase):
class Test_TextTestRunner(unittest.TestCase):
"""Tests for TextTestRunner."""
+ def setUp(self):
+ # clean the environment from pre-existing PYTHONWARNINGS to make
+ # test_warnings results consistent
+ self.pythonwarnings = os.environ.get('PYTHONWARNINGS')
+ if self.pythonwarnings:
+ del os.environ['PYTHONWARNINGS']
+
+ def tearDown(self):
+ # bring back pre-existing PYTHONWARNINGS if present
+ if self.pythonwarnings:
+ os.environ['PYTHONWARNINGS'] = self.pythonwarnings
+
def test_init(self):
runner = unittest.TextTestRunner()
self.assertFalse(runner.failfast)