Skip to content

Commit ea55cd8

Browse files
committed
fix(ci): add pythonpath=["."] to pytest config
test_track_span_context.py uses 'from tests.conftest import BASE_URL' which requires the tests/ directory to be importable as a top-level package. On Python 3.10/3.11 (CI matrix) pytest's rootdir discovery lands on the repo root rather than the tests/ directory, so 'tests' is not on sys.path and the import raises ModuleNotFoundError at collection time, failing one test: FAILED tests/test_track_span_context.py::test_module_level_track_llm_output_tokens_optional ModuleNotFoundError: No module named 'tests' On Python 3.14 the same code passes because pytest-asyncio / hatchling pyproject discovery adds the repo root to sys.path. 3.10/3.11 don't get that for free. Add 'pythonpath = ["."]' to [tool.pytest.ini_options] so all Python versions in the supported matrix resolve 'tests' as a top-level module.
1 parent 90cbc54 commit ea55cd8

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

pyproject.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,12 @@ ignore = [
146146
asyncio_mode = "auto"
147147
testpaths = ["tests"]
148148
addopts = "--tb=short -q"
149+
# Make the tests/ directory importable as a top-level package so
150+
# tests can use `from tests.conftest import BASE_URL`. Without this,
151+
# `from tests.conftest` raises ModuleNotFoundError on Python 3.10/3.11
152+
# because pytest's rootdir discovery lands on the repo root rather
153+
# than the tests/ directory.
154+
pythonpath = ["."]
149155

150156
[tool.coverage.run]
151157
source = ["src/nullrun"]

0 commit comments

Comments
 (0)