summaryrefslogtreecommitdiffstats
path: root/Lib/unittest/test
diff options
context:
space:
mode:
authorŁukasz Langa <lukasz@langa.pl>2013-04-23 23:51:42 (GMT)
committerŁukasz Langa <lukasz@langa.pl>2013-04-23 23:51:42 (GMT)
commit06d3abbff3fee303e99ef4bd01cb66a505d291ba (patch)
tree21ef076d39c0a050e5be08964be06b38c9ba1d69 /Lib/unittest/test
parent1ca17c28d27299329ba981c149a370c2e39a02e9 (diff)
parent6ae466732c6a5cd988d02110ab0538c7752a3253 (diff)
downloadcpython-06d3abbff3fee303e99ef4bd01cb66a505d291ba.zip
cpython-06d3abbff3fee303e99ef4bd01cb66a505d291ba.tar.gz
cpython-06d3abbff3fee303e99ef4bd01cb66a505d291ba.tar.bz2
clean the environment from pre-existing PYTHONWARNINGS for test_warnings
Diffstat (limited to 'Lib/unittest/test')
-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)