Repository navigation
Mark autouse fixtures with [autouse] in --setup-show and --fixtures-per-test - #15540
Open
Alexander683 wants to merge 1 commit into
Open
Alexander683 wants to merge 1 commit into
Alexander683 wants to merge 1 commit into
Conversation
…er-test Append [autouse] to SETUP/TEARDOWN lines in _show_fixture_action (covering --setup-show, --setup-only, and --setup-plan) and to fixture headers in --fixtures-per-test (styled in cyan, matching --fixtures scope tags). Closes pytest-dev#14920 Co-authored-by: Antigravity (Gemini) <noreply@google.com>
This branch has not been deployed
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.
Marks autouse fixtures with
[autouse]in--setup-show,--setup-only,--setup-plan, and--fixtures-per-testso it is clear why fixtures not explicitly listed as test parameters appear in the output.Closes #14920
Summary of changes
src/_pytest/setuponly.py: Append[autouse]in_show_fixture_actionwhenfixturedef._autouseisTrue(shared by--setup-show,--setup-only, and--setup-plan).src/_pytest/fixtures.py: Append[autouse]in cyan in_show_fixtures_per_test(matching the[<scope> scope]style in--fixtures), and update the outdated comment onFixtureDef._autouse.testing/test_setuponly.py&testing/python/show_fixtures_per_test.py: Cover autouse vs. explicit fixtures, parametrized/dependent autouse fixtures, private autouse fixtures with-v, and--color=yes.changelog/14920.improvement.rst&AUTHORS: Added changelog newsfragment and author entry.Example output
Checklist
Closes #14920to the PR description and commit.Co-authored-bycommit trailers (assisted by Antigravity / Gemini; diff reviewed locally).changelogdirectory (changelog/14920.improvement.rst).AUTHORSin alphabetical order.