-
-
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
Fixture record_testsuite_property does not work with pytest-xdist #7767
Comments
@marincandenza could you elaborate more on the problem? Xdist by default will create a session per worker, this is by design so an auto use session scopes fixture for example will execute on each of the workers, this can be confusing at first as you expect one pytest execution, however that is not the case as all workers run pytest end to end |
@symonk I have edited my bug description. The xml property on testsuite level will not be logged when invoking with pytest-xdist args n2. |
Related to #5205. |
Thanks @marincandenza, What happens is:
So the To fix this, we need to make the properties part of the TestReport, so they can be correctly transferred to the |
Created a PR adding a warning to the docs: #7773 FTR: I played around a bit but I don't see an easy way to fix this, I pushed to https://github.com/nicoddemus/pytest/tree/xml-properties-xdist-7767. |
Here is a workaround that I use (dirty hack, not a solution):
Obviously inspired by It seems obvious that this doesn't solve propagation from slaves |
Is there any planned work to fix this? I was looking for a way to add user info to the junitxml output. |
Hi @sjalloq, AFAIK nobody is working on it. |
@nicoddemus Thanks. Is it a fixable issue? I.E. is it worth me trying to understand the code base and look at it or is it not worth it? I tried @mganisin's hack and that seems to work okay. |
Hi @sjalloq, TBH I don't remember the details, but it seems like it isn't trivial/obvious to fix however: #7767 (comment) |
To add context, this is an issue when using hypothesis with pytest-xdist with junitxml (#5202, HypothesisWorks/hypothesis#1935) |
So it turns out the Hypothesis pytest plugin actually didn't work with pytest/src/_pytest/junitxml.py Lines 373 to 376 in 00ad12b
The remaining issue with pytest/src/_pytest/junitxml.py Lines 429 to 440 in 00ad12b
Which goes back to this comment:
|
Thinking about this in bit more depth, "expected" behavior shouldn't be expected probably. Having Maybe it could be better if there was a hook provided by junitxml to solve this (with current fixture kept for compatibility and cases without xdist). Probably even better would be to solely depend on |
has there ever been a solution for this? |
According to the docs it is possible to add a junit property at test suite level. This will work fine without pytest-xdist but fails when adding -n2 or similiar to pytest args.
Error description
The test suite properties ARCH, STORAGE_TYPE shown below are not contained in the junit.xml when running pytest-xdist.
Note
I read through the existing test code which does not execute pytest-xdist. Is it wanted to call pytest-xdist in this repository?
How to reproduce
The text was updated successfully, but these errors were encountered: