mirror of
				https://github.com/python/cpython.git
				synced 2025-10-31 05:31:20 +00:00 
			
		
		
		
	gh-127949: deprecate asyncio.get_event_loop_policy (#128053)
				
					
				
			This deprecates `asyncio.get_event_loop_policy` and will be removed in Python 3.16.
This commit is contained in:
		
							parent
							
								
									bad3cdefa8
								
							
						
					
					
						commit
						dbd08fb60d
					
				
					 9 changed files with 40 additions and 26 deletions
				
			
		|  | @ -64,7 +64,7 @@ def setUp(self): | |||
|         asyncio._set_event_loop_policy(policy) | ||||
| 
 | ||||
|     def tearDown(self): | ||||
|         policy = asyncio.get_event_loop_policy() | ||||
|         policy = asyncio._get_event_loop_policy() | ||||
|         if policy.loop is not None: | ||||
|             self.assertTrue(policy.loop.is_closed()) | ||||
|             self.assertTrue(policy.loop.shutdown_ag_run) | ||||
|  | @ -208,7 +208,7 @@ async def main(): | |||
|             await asyncio.sleep(0) | ||||
|             return 42 | ||||
| 
 | ||||
|         policy = asyncio.get_event_loop_policy() | ||||
|         policy = asyncio._get_event_loop_policy() | ||||
|         policy.set_event_loop = mock.Mock() | ||||
|         asyncio.run(main()) | ||||
|         self.assertTrue(policy.set_event_loop.called) | ||||
|  | @ -495,7 +495,7 @@ def test_set_event_loop_called_once(self): | |||
|         async def coro(): | ||||
|             pass | ||||
| 
 | ||||
|         policy = asyncio.get_event_loop_policy() | ||||
|         policy = asyncio._get_event_loop_policy() | ||||
|         policy.set_event_loop = mock.Mock() | ||||
|         runner = asyncio.Runner() | ||||
|         runner.run(coro()) | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Kumar Aditya
						Kumar Aditya