We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 4a50cd8 commit a7f5a2aCopy full SHA for a7f5a2a
aiohttp/test_utils.py
@@ -506,7 +506,15 @@ def setup_test_loop(
506
asyncio.set_event_loop(loop)
507
if sys.platform != "win32" and not skip_watcher:
508
policy = asyncio.get_event_loop_policy()
509
- watcher = asyncio.SafeChildWatcher()
+ try: # Python >= 3.8
510
+ # Refs:
511
+ # * https://github.com/pytest-dev/pytest-xdist/issues/620
512
+ # * https://stackoverflow.com/a/58614689/595220
513
+ # * https://bugs.python.org/issue35621
514
+ # * https://github.com/python/cpython/pull/14344
515
+ watcher = asyncio.ThreadedChildWatcher()
516
+ except AttributeError: # Python < 3.8
517
+ watcher = asyncio.SafeChildWatcher()
518
watcher.attach_loop(loop)
519
with contextlib.suppress(NotImplementedError):
520
policy.set_child_watcher(watcher)
0 commit comments