mirror of
				https://github.com/python/cpython.git
				synced 2025-10-30 21:21:22 +00:00 
			
		
		
		
	gh-121988: Fix test hang when pyrepl is not available (#121990)
Also explicitly fail the test if we timeout while waiting for output so that this failure mode is caught earlier.
This commit is contained in:
		
							parent
							
								
									b7ad711fcb
								
							
						
					
					
						commit
						a09e215abf
					
				
					 1 changed files with 5 additions and 1 deletions
				
			
		|  | @ -964,7 +964,7 @@ def _run_repl_globals_test(self, expectations, *, as_file=False, as_module=False | ||||||
|             mod.write_text("FOO = 42", encoding="utf-8") |             mod.write_text("FOO = 42", encoding="utf-8") | ||||||
|             commands = [ |             commands = [ | ||||||
|                 "print(f'{" + var + "=}')" for var in expectations |                 "print(f'{" + var + "=}')" for var in expectations | ||||||
|             ] + ["exit"] |             ] + ["exit()"] | ||||||
|             if as_file and as_module: |             if as_file and as_module: | ||||||
|                 self.fail("as_file and as_module are mutually exclusive") |                 self.fail("as_file and as_module are mutually exclusive") | ||||||
|             elif as_file: |             elif as_file: | ||||||
|  | @ -1115,6 +1115,10 @@ def run_repl( | ||||||
|             except OSError: |             except OSError: | ||||||
|                 break |                 break | ||||||
|             output.append(data) |             output.append(data) | ||||||
|  |         else: | ||||||
|  |             os.close(master_fd) | ||||||
|  |             process.kill() | ||||||
|  |             self.fail(f"Timeout while waiting for output, got: {''.join(output)}") | ||||||
| 
 | 
 | ||||||
|         os.close(master_fd) |         os.close(master_fd) | ||||||
|         try: |         try: | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Sam Gross
						Sam Gross