mirror of
				https://github.com/python/cpython.git
				synced 2025-11-03 23:21:29 +00:00 
			
		
		
		
	clean the environment from pre-existing PYTHONWARNINGS for test_warnings
This commit is contained in:
		
						commit
						06d3abbff3
					
				
					 1 changed files with 12 additions and 0 deletions
				
			
		| 
						 | 
				
			
			@ -137,6 +137,18 @@ def cleanup2():
 | 
			
		|||
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)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue