Skip to content

Fix --setup-plan fixture lifetimes#6214

Merged
nicoddemus merged 4 commits intopytest-dev:masterfrom
JoshKarpel:fix-setup-plan
Nov 18, 2019
Merged

Fix --setup-plan fixture lifetimes#6214
nicoddemus merged 4 commits intopytest-dev:masterfrom
JoshKarpel:fix-setup-plan

Conversation

@JoshKarpel
Copy link
Contributor

This PR fixes #2049 by setting the fixturedef cache key in the dummy fixture result used when --setup-plan runs (the current implementation does not). This makes the printing of the SETUP/TEARDOWN messages obey the fixture lifetimes as expected (and as already correctly happens with --setup-show).

I added two tests, but they're both rather crude. One just sets up a simple class-scoped fixture and checks that the correct number of messages appear. The other checks that the printed output of --setup-show and --setup-plan agree on the ordering and number of messages. I don't know if there any good idioms for this kind of thing in the test suite already. Happy to make changes if they're not up to snuff!

Copy link
Member

@nicoddemus nicoddemus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot @JoshKarpel! Excellent PR: clean code, very well documented, well written tests. Awesome!

Thanks again!

@nicoddemus nicoddemus merged commit bebd804 into pytest-dev:master Nov 18, 2019
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.

--setup-plan and --setup-only seem to claim different things

2 participants