summaryrefslogtreecommitdiffstats
path: root/Lib/asyncio/test_utils.py
diff options
context:
space:
mode:
authorYury Selivanov <yury@magic.io>2016-11-04 18:29:28 (GMT)
committerYury Selivanov <yury@magic.io>2016-11-04 18:29:28 (GMT)
commit600a349781bfa0a8239e1cb95fac29c7c4a3302e (patch)
tree79f35114de7101a97fe85f80cd02cbd866d4abd9 /Lib/asyncio/test_utils.py
parent1ea023e523f484955fb81b59a72c586845d8d97f (diff)
downloadcpython-600a349781bfa0a8239e1cb95fac29c7c4a3302e.zip
cpython-600a349781bfa0a8239e1cb95fac29c7c4a3302e.tar.gz
cpython-600a349781bfa0a8239e1cb95fac29c7c4a3302e.tar.bz2
Issue #28613: Fix get_event_loop() to return the current loop
when called from coroutines or callbacks.
Diffstat (limited to 'Lib/asyncio/test_utils.py')
-rw-r--r--Lib/asyncio/test_utils.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/Lib/asyncio/test_utils.py b/Lib/asyncio/test_utils.py
index 307fffc..9d32822 100644
--- a/Lib/asyncio/test_utils.py
+++ b/Lib/asyncio/test_utils.py
@@ -449,7 +449,13 @@ class TestCase(unittest.TestCase):
self.set_event_loop(loop)
return 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
+
events.set_event_loop(None)
# Detect CPython bug #23353: ensure that yield/yield-from is not used