clean the environment from pre-existing PYTHONWARNINGS for test_warnings
This commit is contained in:
parent
20ea96f29a
commit
6ae466732c
|
@ -139,6 +139,18 @@ class TestCleanUp(unittest.TestCase):
|
||||||
class Test_TextTestRunner(unittest.TestCase):
|
class Test_TextTestRunner(unittest.TestCase):
|
||||||
"""Tests for TextTestRunner."""
|
"""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):
|
def test_init(self):
|
||||||
runner = unittest.TextTestRunner()
|
runner = unittest.TextTestRunner()
|
||||||
self.assertFalse(runner.failfast)
|
self.assertFalse(runner.failfast)
|
||||||
|
|
Loading…
Reference in New Issue