From 600a349781bfa0a8239e1cb95fac29c7c4a3302e Mon Sep 17 00:00:00 2001 From: Yury Selivanov Date: Fri, 4 Nov 2016 14:29:28 -0400 Subject: Issue #28613: Fix get_event_loop() to return the current loop when called from coroutines or callbacks. --- Lib/asyncio/test_utils.py | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'Lib/asyncio/test_utils.py') diff --git a/Lib/asyncio/test_utils.py b/Lib/asyncio/test_utils.py index 307fffccc6..9d32822fa9 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 -- cgit v1.2.1