aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Lib/test/test_asyncio/utils.py
diff options
context:
space:
mode:
authorYurii Karabas <1998uriyyo@gmail.com>2020-11-24 20:08:54 +0200
committerGitHub <noreply@github.com>2020-11-24 20:08:54 +0200
commit0ec34cab9dd4a7bcddafaeeb445fae0f26afcdd1 (patch)
tree89a37fba7519bd02dca2192e788bf8afe50aecdd /Lib/test/test_asyncio/utils.py
parentb0b428510cfd604a8eef1f245f039331e671ea4a (diff)
downloadcpython-0ec34cab9dd4a7bcddafaeeb445fae0f26afcdd1.tar.gz
cpython-0ec34cab9dd4a7bcddafaeeb445fae0f26afcdd1.zip
bpo-42392: Remove loop parameter form asyncio locks and Queue (#23420)
Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
Diffstat (limited to 'Lib/test/test_asyncio/utils.py')
-rw-r--r--Lib/test/test_asyncio/utils.py16
1 files changed, 15 insertions, 1 deletions
diff --git a/Lib/test/test_asyncio/utils.py b/Lib/test/test_asyncio/utils.py
index 34da7390e1b..aba90c970a8 100644
--- a/Lib/test/test_asyncio/utils.py
+++ b/Lib/test/test_asyncio/utils.py
@@ -546,7 +546,21 @@ class TestCase(unittest.TestCase):
def setUp(self):
self._get_running_loop = events._get_running_loop
- events._get_running_loop = lambda: None
+
+ def _get_running_loop():
+ frame = sys._getframe(1)
+
+ if frame.f_globals['__name__'] == 'asyncio.mixins':
+ # When we called from LoopBoundedMixin we should
+ # fallback to default implementation of get_running_loop
+ try:
+ return events.get_running_loop()
+ except RuntimeError:
+ return None
+
+ return None
+
+ events._get_running_loop = _get_running_loop
self._thread_cleanup = threading_helper.threading_setup()
def tearDown(self):