bpo-29703: asyncio: Fix creating new event loops in child processes. (#404)

This commit is contained in:
Yury Selivanov 2017-03-02 20:07:11 -05:00 committed by GitHub
parent cdf037c212
commit ba7e1f9a4e
4 changed files with 36 additions and 2 deletions

View file

@ -449,12 +449,15 @@ def new_test_loop(self, gen=None):
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)