-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
8.0.0 reverses order of parametrize when calling individual tests #11937
Comments
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.
Thanks @okken for the clear report and @The-Compiler for bisecting. Submitted a fix in #11957. |
@The-Compiler I really need to lean on bisect more often. You're an inspiration. |
Hah, the moment I found out about For reference, for something like this, what I do is something like:
After the initial range, I needed to test < 10 times to find the culprit, so it's something that can usually be done in minutes once there is a nice fast reproducer. |
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.
Summary
Marking a test with
@pytest.mark.parametrize('i', [1, 2, 3, 4])
, I expect the test to run 1, 2, 3, 4.As a file, pytest does this as expected.
Running individual tests, though, results in 4, 3, 2, 1.
This is surprising behavior and new to 8.0.0.
Version 7.4.4 runs the test cases in the expected 1, 2, 3, 4 order.
Detail
a detailed description of the bug or problem you are having
When running individual parametrized tests, the order is reversed.
This is new in 8.0.0, and not the case in 7.4.4
Since 8.0.0 doesn't guarantee backward compatibility, I'm not sure if this is a bug or a feature. :)
But I didn't see it in the notes, so I'm guessing this is an unintended change, and it is an unexpected, surprising behavior.
output of
pip list
from the virtual environment you are usingplatform win32 -- Python 3.11.7, pytest-8.0.0, pluggy-1.3.0
Output from 8.0.0, shows expected 1,2,3,4 order with file invocation, but reverse order with individual test, 4, 3, 2, 1
Output from 7.4.4, shows expected 1,2,3,4 order with both file and individual test invocation.
The text was updated successfully, but these errors were encountered: