Skip to content

Commit a7f5a2a

Browse files
committed
1 parent 4a50cd8 commit a7f5a2a

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

aiohttp/test_utils.py

+9-1
Original file line numberDiff line numberDiff line change
@@ -506,7 +506,15 @@ def setup_test_loop(
506506
asyncio.set_event_loop(loop)
507507
if sys.platform != "win32" and not skip_watcher:
508508
policy = asyncio.get_event_loop_policy()
509-
watcher = asyncio.SafeChildWatcher()
509+
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()
510518
watcher.attach_loop(loop)
511519
with contextlib.suppress(NotImplementedError):
512520
policy.set_child_watcher(watcher)

0 commit comments

Comments
 (0)