From 5bc48b3dfea9312debe39f8b203bc497349ab373 Mon Sep 17 00:00:00 2001 From: Yury Selivanov Date: Wed, 23 Nov 2016 19:34:08 -0500 Subject: [PATCH] win/tests: Use IOCP asyncio loop on Windows --- uvloop/_testbase.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/uvloop/_testbase.py b/uvloop/_testbase.py index a645645..4d6f187 100644 --- a/uvloop/_testbase.py +++ b/uvloop/_testbase.py @@ -306,7 +306,11 @@ class AIOTestCase(BaseTestCase): super().tearDown() def new_loop(self): - return asyncio.new_event_loop() + if hasattr(asyncio, 'ProactorEventLoop'): + # On Windows try to use IOCP event loop. + return asyncio.ProactorEventLoop() + else: + return asyncio.new_event_loop() def has_IPv6():