tests: ignore attr-defined errors for fake dotenv in test_config.py #29
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
Mypy currently reports
attr-definederrors becausetypes.ModuleTypehas nodotenv_valuesattribute. We fake adotenvmodule in tests but haven’t told mypy about it.Affected file
tests/test_config.pyImplementation Details
Added inline
# type: ignore[attr-defined]comments to the twofake_dotenv.dotenv_valuesassignments to suppress these mypy errors in tests.Assumptions
tests/test_config.pyrequire this change. No changes to production code needed.Testing
uv run mypy tests/test_config.py— no issues found.uv run pytest tests/test_config.py— tests pass.Considerations
Chose inline type ignores for minimal impact and to keep tests clear. Alternatively could configure mypy to ignore the entire file, but inline ignores are more targeted.