Skip to content

typing: Make less use of ParamSpec#600

Merged
jelmer merged 2 commits intotesting-cabal:masterfrom
stephenfin:typing
Apr 5, 2026
Merged

typing: Make less use of ParamSpec#600
jelmer merged 2 commits intotesting-cabal:masterfrom
stephenfin:typing

Conversation

@stephenfin
Copy link
Copy Markdown
Contributor

@stephenfin stephenfin commented Apr 5, 2026

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.

We also need to fix compatibility with mypy 1.20.0, which was released a few days ago.

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>
@jelmer jelmer merged commit 2c9f793 into testing-cabal:master Apr 5, 2026
9 checks passed
@stephenfin stephenfin deleted the typing branch April 6, 2026 10:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants