We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 07c2df7 commit f97b8c7Copy full SHA for f97b8c7
sniffio/_tests/test_sniffio.py
@@ -58,6 +58,29 @@ async def this_is_asyncio():
58
current_async_library()
59
60
61
+def test_in_call_soon_threadsafe():
62
+ import asyncio
63
+
64
+ asynclib = None
65
+ completed = asyncio.Event()
66
67
+ def sync_in_loop():
68
+ nonlocal asynclib
69
+ try:
70
+ asynclib = current_async_library()
71
+ finally:
72
+ completed.set()
73
74
+ async def async_in_loop():
75
+ completed.wait()
76
77
+ loop = asyncio.new_event_loop()
78
+ handle = loop.call_soon_threadsafe(sync_in_loop)
79
+ loop.run_until_complete(async_in_loop())
80
81
+ assert asynclib == 'asyncio'
82
83
84
# https://github.com/dabeaz/curio/pull/354
85
@pytest.mark.skipif(
86
os.name == "nt" and sys.version_info >= (3, 9),
0 commit comments