mirror of
				https://github.com/python/cpython.git
				synced 2025-10-31 21:51:50 +00:00 
			
		
		
		
	[3.13] gh-121359: make clean environment (no PYTHON* vars) for test_pyrepl.TestMain (GH-121672) (GH-121810)
(cherry picked from commit fd085a411e)
Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
			
			
This commit is contained in:
		
							parent
							
								
									835f4add60
								
							
						
					
					
						commit
						2ee2bfe617
					
				
					 1 changed files with 13 additions and 0 deletions
				
			
		|  | @ -884,6 +884,19 @@ def test_bracketed_paste_single_line(self): | |||
| 
 | ||||
| @skipUnless(pty, "requires pty") | ||||
| class TestMain(TestCase): | ||||
|     def setUp(self): | ||||
|         # Cleanup from PYTHON* variables to isolate from local | ||||
|         # user settings, see #121359.  Such variables should be | ||||
|         # added later in test methods to patched os.environ. | ||||
|         clean_env = os.environ.copy() | ||||
|         for k in clean_env.copy(): | ||||
|             if k.startswith("PYTHON"): | ||||
|                 clean_env.pop(k) | ||||
| 
 | ||||
|         patcher = patch('os.environ', new=clean_env) | ||||
|         self.addCleanup(patcher.stop) | ||||
|         patcher.start() | ||||
| 
 | ||||
|     @force_not_colorized | ||||
|     def test_exposed_globals_in_repl(self): | ||||
|         pre = "['__annotations__', '__builtins__'" | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Miss Islington (bot)
						Miss Islington (bot)