File tree 1 file changed +10
-1
lines changed
1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -506,7 +506,16 @@ def setup_test_loop(
506
506
asyncio .set_event_loop (loop )
507
507
if sys .platform != "win32" and not skip_watcher :
508
508
policy = asyncio .get_event_loop_policy ()
509
- watcher = asyncio .SafeChildWatcher ()
509
+ watcher : asyncio .AbstractChildWatcher
510
+ try : # Python >= 3.8
511
+ # Refs:
512
+ # * https://github.com/pytest-dev/pytest-xdist/issues/620
513
+ # * https://stackoverflow.com/a/58614689/595220
514
+ # * https://bugs.python.org/issue35621
515
+ # * https://github.com/python/cpython/pull/14344
516
+ watcher = asyncio .ThreadedChildWatcher ()
517
+ except AttributeError : # Python < 3.8
518
+ watcher = asyncio .SafeChildWatcher ()
510
519
watcher .attach_loop (loop )
511
520
with contextlib .suppress (NotImplementedError ):
512
521
policy .set_child_watcher (watcher )
You can’t perform that action at this time.
0 commit comments