summaryrefslogtreecommitdiffstats
path: root/Lib/asyncio/test_utils.py
diff options
context:
space:
mode:
authorYury Selivanov <yselivanov@gmail.com>2017-03-03 03:06:15 (GMT)
committerGitHub <noreply@github.com>2017-03-03 03:06:15 (GMT)
commit01e5230ef0b28658cf7311be199363eda98808bd (patch)
treed794fb36ed44e62c43429353c9a76d64c956779e /Lib/asyncio/test_utils.py
parenta6e84933d204f807e0e81b6a2237193b2e8ab89a (diff)
downloadcpython-01e5230ef0b28658cf7311be199363eda98808bd.zip
cpython-01e5230ef0b28658cf7311be199363eda98808bd.tar.gz
cpython-01e5230ef0b28658cf7311be199363eda98808bd.tar.bz2
bpo-29703: asyncio: Fix creating new event loops in child processes. (#404) (#410)
Diffstat (limited to 'Lib/asyncio/test_utils.py')
-rw-r--r--Lib/asyncio/test_utils.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/Lib/asyncio/test_utils.py b/Lib/asyncio/test_utils.py
index 99e3839..b12d5db 100644
--- a/Lib/asyncio/test_utils.py
+++ b/Lib/asyncio/test_utils.py
@@ -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)