bpo-32296: Unbreak tests on Windows (#4850)

This commit is contained in:
Yury Selivanov 2017-12-13 17:28:41 -05:00 committed by GitHub
parent 11a247df88
commit bfbf04ef18
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 4 deletions

View File

@ -2735,13 +2735,16 @@ class GetEventLoopTestsMixin:
self.loop = asyncio.new_event_loop()
asyncio.set_event_loop(self.loop)
watcher = asyncio.SafeChildWatcher()
watcher.attach_loop(self.loop)
asyncio.set_child_watcher(watcher)
if sys.platform != 'win32':
watcher = asyncio.SafeChildWatcher()
watcher.attach_loop(self.loop)
asyncio.set_child_watcher(watcher)
def tearDown(self):
try:
asyncio.set_child_watcher(None)
if sys.platform != 'win32':
asyncio.set_child_watcher(None)
super().tearDown()
finally:
self.loop.close()