-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Integrate pytest-subtests #13738
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
Integrate pytest-subtests #13738
Conversation
|
I agree that this feature should be in pytest core because it's a feature in unittest and pytest should aim to be a drop in replacement for unittest (plus the original issue have 40 👍 and no 👎 at time of writing, overwhelming popular support in my book). |
|
I recall we need to fix marking the owning test case as failed if one subtest fails |
|
But yeah i want to see this in |
|
Sounds reasonable |
b43ab38 to
97ee032
Compare
97ee032 to
6b5831f
Compare
5f56d81 to
c93c0e0
Compare
|
Ready for an initial review folks. |
c93c0e0 to
b569c93
Compare
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.
Nice to see this happening.
I ran out of time for the review for today, so didn't really get to the implementation parts, but already have some comments so submitting a partial review.
b569c93 to
506c75b
Compare
42f910d to
ec3144f
Compare
|
we might want to bikeshed a api around sub-section, subtests and parameter loops a little - not necessarily for doing right now - but for setting up a roadmap |
|
I was hoping to get this feature into 9.0, if possible. |
|
we absolutely want this in 9.0 we shouldnt change the api to ensure compat with existing users we should try to ensure lastfailed does rerun tests with failed subtests before releasing 9.0 |
I will add a test, good call. |
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.
Unfortunately ran out of time to do a full review again, but left some comments.
I also noticed two things while I was testing it:
If some or all subtests fail, the parent test is still PASSED, is this intentional?
For some reason the errors are shown as "Captured log call", seems wrong as there are not log calls in my test.
Regarding the name SUBPASS etc., I saw that regular pass is PASSED so I wonder it shouldn't be SUBPASSED etc? (I can check the code later).
|
Now the top-level test will fail with a message in case it contains failed subtests but otherwise does not contain failed assertions on its own: |
d8c7655 to
1c31ff1
Compare
In addition, enable the plugin in `pytest/__init__.py` and `config/__init__.py`.
Co-authored-by: Ran Benita <[email protected]>
for more information, see https://pre-commit.ci
c5f0f51 to
a8c23ec
Compare
|
Merged! Thanks @bluetech for the thorough review. 👍 |
This PR copies the files from
pytest-subtestsand fixes a number of integration issues, code simplification, --lf/--sw support, etc.Why?
Pros
subtestsis a standardunittestfeature, so it makes sense for pytest to support it as well.Cons
This PR 👍 votes and no 👎 votes, so we proceeded with the integration.
Fixes #1367, Fixes pytest-dev/pytest-subtests#71