Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix --setup-plan fixture lifetimes #6214

Merged
merged 4 commits into from Nov 18, 2019
Merged

Conversation

@JoshKarpel
Copy link
Contributor

JoshKarpel commented Nov 17, 2019

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!

JoshKarpel added 4 commits Nov 17, 2019
Copy link
Member

nicoddemus left a comment

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
5 checks passed
5 checks passed
codecov/changes No unexpected coverage changes found.
Details
codecov/patch 100% of diff hit (target 96.36%)
Details
codecov/project 96.36% (+<.01%) compared to f24f20a
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
pytest-CI #20191117.6 succeeded
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.