You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add return type annotation to FixtureRequest.node - #15226
🤖 Written by Claude Opus 5.5 via Claude Code for the pytest maintainers; I prompted it, it did the work, I read it.
Thanks for the PR, but I'm closing it. request.node is left untyped on purpose. See bluetech's reasoning in #13888 (comment): a declared Node (or Item | Collector) return type would force users to assert isinstance(...) or cast whenever they know the concrete type, which is the common case.
With this change, mypy --strict on user code like request.node.callspec, request.node.function or request.node.rep_call (the documented pattern for making test reports available in fixtures) fails with "Node" has no attribute .... All of those pass on main.
It also duplicates the earlier #15103, which proposes the same change.
A follow-up PR will add a comment in the source that explains this, so the question doesn't keep coming back.
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
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.
No description provided.