typing: Make less use of ParamSpec#600
Merged
jelmer merged 2 commits intotesting-cabal:masterfrom Apr 5, 2026
Merged
Conversation
Beyond some tweaks to `type: ignore` comments, we need to disable the `warn_unused_configs = true` option to work around [1]. We also take the opportunity to drop the unnecessary `warn_unused_ignores = true` option which is already handled by `strict = true` [1] python/mypy#21137 Signed-off-by: Stephen Finucane <stephen@that.guru>
This is a partial revert of 1078647. mypy (and possibly others) are not able to correctly resolve a ParamSpec for an overridden method. This causes a lot of false positives when using assertRaises (as a function) on methods with overrides, which cannot be resolved except through `type: ignore` statements. In addition, it's often desirable to test functions with incorrect types to assert runtime validation. Given these two issues, it's easier to just drop the use of ParamSpec. Signed-off-by: Stephen Finucane <stephen@that.guru>
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.
This is a partial revert of 1078647. mypy (and possibly others) are not able to correctly resolve a ParamSpec for an overridden method. This causes a lot of false positives when using assertRaises (as a function) on methods with overrides, which cannot be resolved except through
type: ignorestatements. In addition, it's often desirable to test functions with incorrect types to assert runtime validation. Given these two issues, it's easier to just drop the use of ParamSpec.We also need to fix compatibility with mypy 1.20.0, which was released a few days ago.