mirror of
				https://github.com/python/cpython.git
				synced 2025-10-30 21:21:22 +00:00 
			
		
		
		
	Break up TestCommandLine.test_env_var into four distinct tests.
This commit is contained in:
		
							parent
							
								
									7ffa2c5fdd
								
							
						
					
					
						commit
						34cd2ae69f
					
				
					 1 changed files with 5 additions and 3 deletions
				
			
		|  | @ -748,26 +748,28 @@ def test_filter_match_trace(self): | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| class TestCommandLine(unittest.TestCase): | class TestCommandLine(unittest.TestCase): | ||||||
|     def test_env_var(self): |     def test_env_var_disabled_by_default(self): | ||||||
|         # not tracing by default |         # not tracing by default | ||||||
|         code = 'import tracemalloc; print(tracemalloc.is_tracing())' |         code = 'import tracemalloc; print(tracemalloc.is_tracing())' | ||||||
|         ok, stdout, stderr = assert_python_ok('-c', code) |         ok, stdout, stderr = assert_python_ok('-c', code) | ||||||
|         stdout = stdout.rstrip() |         stdout = stdout.rstrip() | ||||||
|         self.assertEqual(stdout, b'False') |         self.assertEqual(stdout, b'False') | ||||||
| 
 | 
 | ||||||
|         # PYTHON* environment variables must be ignored when -E option is |     def test_env_var_ignored_with_E(self): | ||||||
|         # present |         """PYTHON* environment variables must be ignored when -E is present.""" | ||||||
|         code = 'import tracemalloc; print(tracemalloc.is_tracing())' |         code = 'import tracemalloc; print(tracemalloc.is_tracing())' | ||||||
|         ok, stdout, stderr = assert_python_ok('-E', '-c', code, PYTHONTRACEMALLOC='1') |         ok, stdout, stderr = assert_python_ok('-E', '-c', code, PYTHONTRACEMALLOC='1') | ||||||
|         stdout = stdout.rstrip() |         stdout = stdout.rstrip() | ||||||
|         self.assertEqual(stdout, b'False') |         self.assertEqual(stdout, b'False') | ||||||
| 
 | 
 | ||||||
|  |     def test_env_var_enabled_at_startup(self): | ||||||
|         # tracing at startup |         # tracing at startup | ||||||
|         code = 'import tracemalloc; print(tracemalloc.is_tracing())' |         code = 'import tracemalloc; print(tracemalloc.is_tracing())' | ||||||
|         ok, stdout, stderr = assert_python_ok('-c', code, PYTHONTRACEMALLOC='1') |         ok, stdout, stderr = assert_python_ok('-c', code, PYTHONTRACEMALLOC='1') | ||||||
|         stdout = stdout.rstrip() |         stdout = stdout.rstrip() | ||||||
|         self.assertEqual(stdout, b'True') |         self.assertEqual(stdout, b'True') | ||||||
| 
 | 
 | ||||||
|  |     def test_env_limit(self): | ||||||
|         # start and set the number of frames |         # start and set the number of frames | ||||||
|         code = 'import tracemalloc; print(tracemalloc.get_traceback_limit())' |         code = 'import tracemalloc; print(tracemalloc.get_traceback_limit())' | ||||||
|         ok, stdout, stderr = assert_python_ok('-c', code, PYTHONTRACEMALLOC='10') |         ok, stdout, stderr = assert_python_ok('-c', code, PYTHONTRACEMALLOC='10') | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Gregory P. Smith
						Gregory P. Smith