Set the Python path correctly during pytest invocation
Marco Ricci

Marco Ricci commited on 2026-07-05 21:31:22
Zeige 1 geänderte Dateien mit 1 Einfügungen und 1 Löschungen.


Some of our tests spawn subprocesses, and without this, the subprocesses
fail to import code from the `tests` hierarchy (e.g., `tests.data`.)

We have so far sidestepped this issue by requiring `$PYTHONPATH` to be
set accordingly, but it turns out that setting this in the pytest
settings works even more reliably.

In the long run, it might be smarter to use a similar source layout
in `tests` as we already do in `src`: a top-level
`test_derivepassphrase` package, and the `data`, `machinery` and other
tests modules/packages as submodules/subpackages of
`test_derivepassphrase`.
... ...
@@ -457,7 +457,7 @@ unnecessary-type-conversion = "ignore"
457 457
 
458 458
 [tool.pytest.ini_options]
459 459
 addopts = '--doctest-modules --dist=loadgroup --import-mode=importlib'
460
-pythonpath = ['src']
460
+pythonpath = ['src', '.']
461 461
 testpaths = ['src', 'tests']
462 462
 xfail_strict = true
463 463
 
464 464