summaryrefslogtreecommitdiff
path: root/Lib/test/test_coroutines.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_coroutines.py')
-rw-r--r--Lib/test/test_coroutines.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/Lib/test/test_coroutines.py b/Lib/test/test_coroutines.py
index 8a531b8889..a97535a12a 100644
--- a/Lib/test/test_coroutines.py
+++ b/Lib/test/test_coroutines.py
@@ -8,6 +8,7 @@ import types
import unittest
import warnings
from test import support
+from test.support.script_helper import assert_python_ok
class AsyncYieldFrom:
@@ -2168,6 +2169,27 @@ class OriginTrackingTest(unittest.TestCase):
finally:
warnings._warn_unawaited_coroutine = orig_wuc
+
+class UnawaitedWarningDuringShutdownTest(unittest.TestCase):
+ # https://bugs.python.org/issue32591#msg310726
+ def test_unawaited_warning_during_shutdown(self):
+ code = ("import asyncio\n"
+ "async def f(): pass\n"
+ "asyncio.gather(f())\n")
+ assert_python_ok("-c", code)
+
+ code = ("import sys\n"
+ "async def f(): pass\n"
+ "sys.coro = f()\n")
+ assert_python_ok("-c", code)
+
+ code = ("import sys\n"
+ "async def f(): pass\n"
+ "sys.corocycle = [f()]\n"
+ "sys.corocycle.append(sys.corocycle)\n")
+ assert_python_ok("-c", code)
+
+
@support.cpython_only
class CAPITest(unittest.TestCase):