Apply mypy-tests custom config to other mypy-based tests#13825
Merged
srittau merged 12 commits intopython:mainfrom Apr 28, 2025
Merged
Conversation
…s' of https://github.com/Avasam/typeshed into Apply-mypy-tests-custom-config-to-other-mypy-based-tests
srittau
reviewed
Apr 14, 2025
lib/ts_utils/mypy.py
Outdated
Comment on lines
54
to
57
| @contextmanager | ||
| def temporary_mypy_config_file( | ||
| configurations: Iterable[MypyDistConf], | ||
| ) -> Generator[tempfile._TemporaryFileWrapper[str]]: # pyright: ignore[reportPrivateUsage] |
Collaborator
There was a problem hiding this comment.
Not a full review, but I'd prefer to keep the temporary file workaround logic separate from the actual logic for the temporary files.
Collaborator
Author
There was a problem hiding this comment.
Yeah sure that makes sense. We may have to reuse temporary files elsewhere. It'd be nice if already separate.
The workaround used to only be done in tests/mypy_test.py, but I'll extract it and put it somewhere in ts_lib
Avasam
commented
Apr 28, 2025
Comment on lines
+18
to
+27
| # The configuration section in the metadata file looks like the following, with multiple module sections possible | ||
| # [mypy-tests] | ||
| # [mypy-tests.yaml] | ||
| # module_name = "yaml" | ||
| # [mypy-tests.yaml.values] | ||
| # disallow_incomplete_defs = true | ||
| # disallow_untyped_defs = true | ||
|
|
||
|
|
||
| def mypy_configuration_from_distribution(distribution: str) -> list[MypyDistConf]: |
Collaborator
Author
There was a problem hiding this comment.
Maybe this should be a docstring ?
Suggested change
| # The configuration section in the metadata file looks like the following, with multiple module sections possible | |
| # [mypy-tests] | |
| # [mypy-tests.yaml] | |
| # module_name = "yaml" | |
| # [mypy-tests.yaml.values] | |
| # disallow_incomplete_defs = true | |
| # disallow_untyped_defs = true | |
| def mypy_configuration_from_distribution(distribution: str) -> list[MypyDistConf]: | |
| def mypy_configuration_from_distribution(distribution: str) -> list[MypyDistConf]: | |
| """ | |
| The configuration section in the metadata file looks like the following, with multiple module sections possible | |
| ```toml | |
| [mypy-tests] | |
| [mypy-tests.yaml] | |
| module_name = "yaml" | |
| [mypy-tests.yaml.values] | |
| disallow_incomplete_defs = true | |
| disallow_untyped_defs = true | |
| ``` | |
| """ |
Collaborator
There was a problem hiding this comment.
I actually prefer this to be a comment. It doesn't really feel like something that's relevant to the API. That said, it would probably be better to document it in CONTRIBUTING instead.
srittau
approved these changes
Apr 28, 2025
mmingyu
pushed a commit
to mmingyu/typeshed
that referenced
this pull request
May 16, 2025
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.
Extracted from #13627
Also relates to #12178 and #8403
We have the infra/tooling in place for per-stub mypy configuration. But those configs didn't extend to other tests, making it unusable since stubtest would still fail.
Easier with review with whitespace changes hidden.