Open
Conversation
This PR adds `FixtureRequest._own_fixture_defs` and uses it for a more accurate `--setuponly` and `--setupshow` output. This might be a bit overkill for this specific purpose, but `_own_fixture_defs` can also be used to track fixture dependencies for proper teardown in case of parametrized fixtures, see PR pytest-dev#14104. Fixes: pytest-dev#14287
Contributor
Author
|
@bluetech @RonnyPfannschmidt I've taken a slice of #14104 |
bluetech
reviewed
Mar 14, 2026
Member
bluetech
left a comment
There was a problem hiding this comment.
Thanks for splitting this.
I think that only for the benefit of setuponly it is hard to justify the extra complexity added by _own_fixture_defs to the fixture core. Since I can't approve this PR on its merit alone, I'll go over to #14104 to try and see the larger motivation.
Comment on lines
+380
to
+381
| # The argnames evaluated in the current test item, mapping to the FixtureDef | ||
| # they resolved to. |
Member
There was a problem hiding this comment.
"in the current test item" is a good addition, but let's keep the "so far" to make it clear it's a mutable dict that is filled as fixtures are evaluated.
Suggested change
| # The argnames evaluated in the current test item, mapping to the FixtureDef | |
| # they resolved to. | |
| # The argnames evaluated in the current test item so far, mapping to the FixtureDef | |
| # they resolved to. Shared by the TopRequest and all of its SubRequests. |
bluetech
reviewed
Mar 14, 2026
| @@ -377,9 +377,12 @@ def __init__( | |||
| # collection. Dynamically requested fixtures (using | |||
| # `request.getfixturevalue("foo")`) are added dynamically. | |||
| self._arg2fixturedefs: Final = arg2fixturedefs | |||
Member
There was a problem hiding this comment.
Reviewing this inspired me to do a cleanup here: #14290
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 PR adds
FixtureRequest._own_fixture_defsand uses it for a more accurate--setuponlyand--setupshowoutput. This might be a bit overkill for this specific purpose, but_own_fixture_defscan also be used to track fixture dependencies for proper teardown in case of parametrized fixtures, see PR #14104.Fixes: #14287