Skip to content

Commit 050c7f2

Browse files
committed
more path updates for unit tests
1 parent 949af91 commit 050c7f2

1 file changed

Lines changed: 11 additions & 7 deletions

File tree

python/tests/test_pickle_multiprocessing.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,17 +40,21 @@
4040

4141
from . import _pickle_multiprocessing_helpers as helpers
4242

43-
# `pytest --import-mode=importlib` (used in CI) does not prepend the test
44-
# parent directory to `sys.path`; pytest loads `tests` via its own importlib
45-
# hook. multiprocessing forkserver / spawn workers receive only the parent's
43+
# `pytest --import-mode=importlib` (used in CI) does not put the test parent
44+
# directory on `sys.path`; pytest loads `tests` via its own importlib hook.
45+
# multiprocessing forkserver / spawn workers receive only the parent's
4646
# `sys.path` snapshot, not pytest's hook, so they fail to import
4747
# `tests._pickle_multiprocessing_helpers` with `ModuleNotFoundError: No module
48-
# named 'tests'`. Ensure the parent directory of the `tests` package is on
49-
# `sys.path` so workers can resolve it the standard way. Fork start method is
50-
# unaffected (inherits the already-imported module object).
48+
# named 'tests'`. Append (not prepend) the parent directory of the `tests`
49+
# package so workers can resolve it the standard way, *without* shadowing the
50+
# installed `datafusion` wheel — the source tree's `python/datafusion/` has
51+
# no `_internal` extension module (that lives in the wheel under
52+
# site-packages), so prepending would break `from datafusion._internal
53+
# import ...`. Fork start method is unaffected (inherits the already-imported
54+
# module object).
5155
_TESTS_PARENT = str(Path(__file__).resolve().parent.parent)
5256
if _TESTS_PARENT not in sys.path:
53-
sys.path.insert(0, _TESTS_PARENT)
57+
sys.path.append(_TESTS_PARENT)
5458

5559

5660
@contextlib.contextmanager

0 commit comments

Comments
 (0)