summaryrefslogtreecommitdiffstats
path: root/Lib/asyncio/test_utils.py
diff options
context:
space:
mode:
authorYury Selivanov <yselivanov@gmail.com>2017-03-03 02:40:57 (GMT)
committerGitHub <noreply@github.com>2017-03-03 02:40:57 (GMT)
commit8b73b6198bc0753c5ce6e8f91eb7bddc2bd42a73 (patch)
tree78e282630b925b46c0e88456515613709f100015 /Lib/asyncio/test_utils.py
parent564ace834f23587937b325e3545abe3f17fdbd2a (diff)
downloadcpython-8b73b6198bc0753c5ce6e8f91eb7bddc2bd42a73.zip
cpython-8b73b6198bc0753c5ce6e8f91eb7bddc2bd42a73.tar.gz
cpython-8b73b6198bc0753c5ce6e8f91eb7bddc2bd42a73.tar.bz2
bpo-29703: asyncio: Fix creating new event loops in child processes. (#411)
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 9d32822..fe90b9c 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)