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

This commit is contained in:
Yury Selivanov 2017-03-02 22:06:15 -05:00 committed by GitHub
parent a6e84933d2
commit 01e5230ef0
4 changed files with 36 additions and 2 deletions

View file

@ -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)