Skip to content

Commit d634f68

Browse files
authored
Merge pull request #1275 from jakob-keller/multiprocessing-spawn-in-tests
Enforce multiprocessing start method `spawn` in test suite
2 parents 43f8d7c + 0e8c280 commit d634f68

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

tests/conftest.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import asyncio
2+
import multiprocessing
23
import os
34
import random
45
import string
@@ -20,6 +21,12 @@
2021
_PYCHARM_HOSTED = os.environ.get('PYCHARM_HOSTED') == '1'
2122

2223

24+
@pytest.fixture(scope="session", autouse=True)
25+
def always_spawn():
26+
# enforce multiprocessing start method `spawn` to prevent deadlocks in the child
27+
multiprocessing.set_start_method("spawn", force=True)
28+
29+
2330
@pytest.fixture(
2431
scope="session", params=[True, False], ids=['debug[true]', 'debug[false]']
2532
)

0 commit comments

Comments
 (0)