summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2019-08-26 10:14:54 (GMT)
committerGitHub <noreply@github.com>2019-08-26 10:14:54 (GMT)
commit69d22b8fee442c12829a1032a72489c8133de271 (patch)
tree8e0300197085c8a82e62cba2c00e3b48bc7acb5f /Lib/test
parent522a394a72f107ca55701371529b5e4ed20c9fff (diff)
downloadcpython-69d22b8fee442c12829a1032a72489c8133de271.zip
cpython-69d22b8fee442c12829a1032a72489c8133de271.tar.gz
cpython-69d22b8fee442c12829a1032a72489c8133de271.tar.bz2
bpo-34679: Restore instantiation Windows IOCP event loop from non-main thread (GH-15492)
* Restore running proactor event loop from non-main thread Co-Authored-By: Kyle Stanley <aeros167@gmail.com> (cherry picked from commit 1c0600998681295735a18690fae184b0c9a4ca51) Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_asyncio/test_windows_events.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/Lib/test/test_asyncio/test_windows_events.py b/Lib/test/test_asyncio/test_windows_events.py
index 6454326..d0ba193 100644
--- a/Lib/test/test_asyncio/test_windows_events.py
+++ b/Lib/test/test_asyncio/test_windows_events.py
@@ -59,6 +59,25 @@ class ProactorLoopCtrlC(test_utils.TestCase):
thread.join()
+class ProactorMultithreading(test_utils.TestCase):
+ def test_run_from_nonmain_thread(self):
+ finished = False
+
+ async def coro():
+ await asyncio.sleep(0)
+
+ def func():
+ nonlocal finished
+ loop = asyncio.new_event_loop()
+ loop.run_until_complete(coro())
+ finished = True
+
+ thread = threading.Thread(target=func)
+ thread.start()
+ thread.join()
+ self.assertTrue(finished)
+
+
class ProactorTests(test_utils.TestCase):
def setUp(self):