Fix cache contamination#186
Merged
sobolevn merged 7 commits intoApr 14, 2026
Merged
Conversation
1 task
sobolevn
reviewed
Apr 13, 2026
This is available since the minimal supported version https://github.com/python/mypy/blob/release-1.3/mypy/metastore.py
sobolevn
approved these changes
Apr 14, 2026
sobolevn
left a comment
Member
There was a problem hiding this comment.
Let's try this in a patch release :)
Member
|
Thank you! Great work! |
4 tasks
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>
5 tasks
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>
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.
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