mirror of
https://github.com/pybind/pybind11.git
synced 2024-11-22 05:05:11 +00:00
chore: Convert direct multiprocessing.set_start_method("forkserver") call to a pytest fixture. (#4377)
* chore: convert multiprocessing set_spawn to fixture in pytest * Switch to early return
This commit is contained in:
parent
358ba459d2
commit
e133c33d5c
@ -17,7 +17,12 @@ import pytest
|
||||
# Early diagnostic for failed imports
|
||||
import pybind11_tests
|
||||
|
||||
if os.name != "nt":
|
||||
|
||||
@pytest.fixture(scope="session", autouse=True)
|
||||
def always_forkserver_on_unix():
|
||||
if os.name == "nt":
|
||||
return
|
||||
|
||||
# Full background: https://github.com/pybind/pybind11/issues/4105#issuecomment-1301004592
|
||||
# In a nutshell: fork() after starting threads == flakiness in the form of deadlocks.
|
||||
# It is actually a well-known pitfall, unfortunately without guard rails.
|
||||
@ -27,6 +32,7 @@ if os.name != "nt":
|
||||
# running with defaults.
|
||||
multiprocessing.set_start_method("forkserver")
|
||||
|
||||
|
||||
_long_marker = re.compile(r"([0-9])L")
|
||||
_hexadecimal = re.compile(r"0x[0-9a-fA-F]+")
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user