Repository navigation
Conversation
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.
When a test has more than one
ordermarker,pytest_generate_testsparametrizes it with one case per marker and removes theordermarks from the test function, so that each case keeps only its own marker. The function object is shared, though, so when the same function is collected again, for example as a method inherited by a second test class or as a test function imported into another module, the later collection no longer finds anyordermarks. That test then runs only once, without an order marker:Here
TestA::test_xruns first and last as expected, butTestB::test_xruns once in the middle.This change keeps the removed markers on the function and uses them again when the same function is collected another time. Tests with a single order marker or none are not affected.
I added tests for the inherited and the imported case and a changelog entry. The new tests fail without the change, and the test suite passes on Windows with Python 3.11 and pytest 9.2.0 and 6.2.5.