-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
main: fix reversed collection order in Session #11957
Conversation
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.
@@ -241,7 +241,7 @@ def test_issue88_initial_file_multinodes(self, pytester: Pytester) -> None: | |||
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*"]) |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
@@ -241,7 +241,7 @@ def test_issue88_initial_file_multinodes(self, pytester: Pytester) -> None: | |||
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*"]) |
There was a problem hiding this comment.
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?
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.