Skip to content

Commit 7e8f190

Browse files
committed
test: make the src package importable via pythonpath instead of package files
The four empty __init__.py under tests/ existed only so pytest would walk up to the repo root and put it on sys.path, which a bare 'poetry run pytest' needs to import src. Setting pythonpath = ["."] says the same thing in one line, in the place that already configures the suite. The 'src' entry it replaces was vestigial: nothing imports a module without the src. prefix. The __init__.py under src/ stay. They do a different job -- they are what makes coverage.py descend into the package and report modules that no test imports.
1 parent b5d2f5f commit 7e8f190

5 files changed

Lines changed: 1 addition & 1 deletion

File tree

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ ruff = ">=0.15.4,<0.17.0"
1919

2020
[tool.pytest.ini_options]
2121
testpaths = ["tests",]
22-
pythonpath = ["src",]
22+
pythonpath = [".",]
2323

2424
[tool.coverage.run]
2525
branch = true

tests/config/__init__.py

Whitespace-only changes.

tests/integration/__init__.py

Whitespace-only changes.

tests/listeners/__init__.py

Whitespace-only changes.

tests/rules/__init__.py

Whitespace-only changes.

0 commit comments

Comments
 (0)