Skip to content

Conversation

bluetech
Copy link
Member

@bluetech bluetech commented Feb 9, 2024

Since we're working with a stack (last in first out), we need to append to it in reverse to preserve the order when popped.

Fix #11937.

Since we're working with a stack (last in first out), we need to append
to it in reverse to preserve the order when popped.

Fix pytest-dev#11937.
pytester.copy_example("issue88_initial_file_multinodes")
p = pytester.makepyfile("def test_hello(): pass")
result = pytester.runpytest(p, "--collect-only")
result.stdout.fnmatch_lines(["*Module*test_issue88*", "*MyFile*test_issue88*"])
Copy link
Member Author

Choose a reason for hiding this comment

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

This existing test and the one below actually flagged the issue in #11646, but I misdiagnosed it and accepted the changes. So this brings the tests to how they were.

Copy link
Member

Choose a reason for hiding this comment

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

Probably leave a comment making the intent of the test more explicit?

Copy link
Member Author

Choose a reason for hiding this comment

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

This test failing was mostly incidental, it does not aim specifically to test ordering but something with custom nodes. I added the new test to check the order specifically which will be much harder to misdiagnose.

@bluetech bluetech added the needs backport applied to PRs, indicates that it should be ported to the current bug-fix branch label Feb 9, 2024
pytester.copy_example("issue88_initial_file_multinodes")
p = pytester.makepyfile("def test_hello(): pass")
result = pytester.runpytest(p, "--collect-only")
result.stdout.fnmatch_lines(["*Module*test_issue88*", "*MyFile*test_issue88*"])
Copy link
Member

Choose a reason for hiding this comment

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

Probably leave a comment making the intent of the test more explicit?

@bluetech bluetech merged commit 5bb1363 into pytest-dev:main Feb 13, 2024
@bluetech bluetech deleted the fix-session-collect-order branch February 13, 2024 07:44
@bluetech bluetech added backport 8.0.x and removed needs backport applied to PRs, indicates that it should be ported to the current bug-fix branch labels Feb 13, 2024
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.

8.0.0 reverses order of parametrize when calling individual tests

3 participants