Skip to content

Fix cache contamination#186

Merged
sobolevn merged 7 commits into
typeddjango:masterfrom
UnknownPlatypus:fix-cache-contamination
Apr 14, 2026
Merged

Fix cache contamination#186
sobolevn merged 7 commits into
typeddjango:masterfrom
UnknownPlatypus:fix-cache-contamination

Conversation

@UnknownPlatypus

Copy link
Copy Markdown
Contributor

Fixes an issue with cache cleanup when using new mypy cache.

Also bump mypy to latest and update test assertions to make CI pass

Fixes #184

Comment thread pytest_mypy_plugins/item.py Outdated
Comment thread pytest_mypy_plugins/item.py Outdated
Comment thread pytest_mypy_plugins/item.py Outdated

@sobolevn sobolevn left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's try this in a patch release :)

@sobolevn

Copy link
Copy Markdown
Member

Thank you! Great work!

@sobolevn sobolevn merged commit 1117965 into typeddjango:master Apr 14, 2026
16 checks passed
@UnknownPlatypus UnknownPlatypus deleted the fix-cache-contamination branch April 14, 2026 16:29
thodson-usgs pushed a commit to thodson-usgs/pytest-mypy-plugins that referenced this pull request Apr 16, 2026
`MetadataStore.close` was added in mypy 1.20, but `setup.py` still declares
`mypy>=1.3`. PR typeddjango#186 unconditionally calls `store.close()` in cache cleanup,
which raises `AttributeError: 'FilesystemMetadataStore' object has no attribute
'close'` on every test when running against mypy <1.20 (e.g. 1.19.x).

Guard the call with `hasattr` (via `getattr(..., None)`) so it is a no-op on
older mypy versions. Apply the same guard to the parallel helper in
`tests/test_mypy_cache.py`.

Adds a regression test that emulates older mypy by stripping `close` from the
store classes via a conftest in the subprocess test directory, and asserts the
plugin teardown completes without `AttributeError`.

Co-authored-by: Claude <noreply@anthropic.com>
sobolevn pushed a commit that referenced this pull request Apr 17, 2026
* Fix AttributeError on store.close() with mypy < 1.20

`MetadataStore.close` was added in mypy 1.20, but `setup.py` still declares
`mypy>=1.3`. PR #186 unconditionally calls `store.close()` in cache cleanup,
which raises `AttributeError: 'FilesystemMetadataStore' object has no attribute
'close'` on every test when running against mypy <1.20 (e.g. 1.19.x).

Guard the call with `hasattr` (via `getattr(..., None)`) so it is a no-op on
older mypy versions. Apply the same guard to the parallel helper in
`tests/test_mypy_cache.py`.

Adds a regression test that emulates older mypy by stripping `close` from the
store classes via a conftest in the subprocess test directory, and asserts the
plugin teardown completes without `AttributeError`.

Co-authored-by: Claude <noreply@anthropic.com>

* Remove test

---------

Co-authored-by: thodson-usgs <tohodson@gmail.com>
Co-authored-by: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants