Skip to content

Commit f93087c

Browse files
yhryzyyhryzy
authored andcommitted
test: make experiment scripts importable in CI
1 parent 36bf8a8 commit f93087c

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

‎tests/conftest.py‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,13 @@
77

88
import pytest
99

10-
# Ensure vulca package is importable from src/
11-
sys.path.insert(0, os.path.join(os.path.dirname(__file__), "..", "src"))
10+
# Ensure local packages are importable under both `python -m pytest` and
11+
# the `pytest` console script used by CI.
12+
_REPO_ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))
13+
_SRC_ROOT = os.path.join(_REPO_ROOT, "src")
14+
for _path in (_REPO_ROOT, _SRC_ROOT):
15+
if _path not in sys.path:
16+
sys.path.insert(0, _path)
1217

1318

1419
def pytest_addoption(parser):

0 commit comments

Comments
 (0)