Add tests/__init__.py to fix mypy duplicate-module error - #96
Merged
Conversation
Running `mypy vesper tests` failed immediately with: tests/conftest.py: error: Source file found twice under different module names: "conftest" and "tests.conftest" because `tests/` had no `__init__.py`, so mypy saw conftest under two module names. The test suite already imports `from tests.conftest import ...` (test_historian.py, test_mcp.py), so treating `tests` as a package is the intended design -- this makes it explicit, as mypy itself recommends. Note: this change was already in effect for runtime/pytest. It only corrects the mypy module resolution. Fixing the resulting unmasked test-suite type errors is tracked separately. Closes #82
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #82.
Running
mypy vesper testsfailed immediately with:because
tests/had no__init__.py, so mypy resolvedconftestunder two module names. The test suite already importsfrom tests.conftest import ...(intest_historian.pyandtest_mcp.py), so treatingtestsas a package is the intended design — this makes it explicit, which is exactly the "simplest" option mypy itself recommends and the issue lists first.This change was already in effect for runtime/pytest; it only corrects mypy's module resolution. After this change
mypyno longer aborts with the duplicate-module error, and the production code (mypy vesper) remains fully clean (0 issues).Follow-up
Fixing the duplicate-module error unmasked 51 pre-existing type errors in the test suite that mypy previously never reached (it aborted at the duplicate-module error before checking the test files). These are tracked separately in a follow-up issue and are out of scope here — this PR fixes the reported bug only.
Verification
Exact commands run (per
AGENTS.md, using the project virtualenv):Closes #82.