mirror of
https://github.com/python/cpython.git
synced 2025-10-05 22:51:56 +00:00
bpo-29703: asyncio: Fix creating new event loops in child processes. (#411)
This commit is contained in:
parent
564ace834f
commit
8b73b6198b
4 changed files with 36 additions and 2 deletions
|
@ -449,12 +449,15 @@ class TestCase(unittest.TestCase):
|
|||
self.set_event_loop(loop)
|
||||
return loop
|
||||
|
||||
def unpatch_get_running_loop(self):
|
||||
events._get_running_loop = self._get_running_loop
|
||||
|
||||
def setUp(self):
|
||||
self._get_running_loop = events._get_running_loop
|
||||
events._get_running_loop = lambda: None
|
||||
|
||||
def tearDown(self):
|
||||
events._get_running_loop = self._get_running_loop
|
||||
self.unpatch_get_running_loop()
|
||||
|
||||
events.set_event_loop(None)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue