Skip to content

Commit b2a2297

Browse files
committed
Revert "revert conftest.py"
This reverts commit 0f86c59.
1 parent 0f86c59 commit b2a2297

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

tests/conftest.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import csv
22
import os
33
import shutil
4+
import sys
45
from pathlib import Path
56

67
import fsspec
@@ -13,6 +14,19 @@
1314
settings.load_profile("default")
1415

1516

17+
# Make the repo root importable from `multiprocessing` spawn children so that
18+
# tests using ProcessPoolExecutor (e.g. test_process_single_position with
19+
# use_threads=False) can unpickle helpers like `tests.ngff.test_ngff_utils.
20+
# dummy_transform`. pytest's `--import-mode=importlib` only manipulates the
21+
# parent process's sys.path, not the env that spawn children inherit.
22+
_REPO_ROOT = Path(__file__).resolve().parent.parent
23+
os.environ["PYTHONPATH"] = os.pathsep.join(
24+
[str(_REPO_ROOT)] + ([os.environ["PYTHONPATH"]] if os.environ.get("PYTHONPATH") else [])
25+
)
26+
if str(_REPO_ROOT) not in sys.path:
27+
sys.path.insert(0, str(_REPO_ROOT))
28+
29+
1630
@pytest.fixture
1731
def rng():
1832
return np.random.default_rng(42)

0 commit comments

Comments
 (0)