test: keep subprocess imports on the active worktree

This commit is contained in:
阿白叔 committed 2026-11-17 00:39:29 +08:00
1 parent eabf61c73b
commit 5b7e7bea2f
3 files changed
+26 -1

No files matched your search

+10
View File
@@ -0,0 +1,10 @@
"""Keep subprocess imports on the worktree being tested."""
import os
from pathlib import Path
def pytest_configure():
source = str(Path(__file__).resolve().parents[1] / 'src')
existing = os.environ.get('PYTHONPATH', '').split(os.pathsep)
os.environ['PYTHONPATH'] = os.pathsep.join(
[source, *(entry for entry in existing if entry and entry != source)])