-
Notifications
You must be signed in to change notification settings - Fork 230
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
pytest-xdist is not reporting the same nodeid as pytest does #445
Comments
Hi @elyezer, Really sorry for the delay in answering this! Thanks a lot for the detailed report, we appreciate it. The problem is related to the
Definitely a bug, thanks for the report. |
Actually the underlying cause is the For now a workaround is to rename your
|
Related: #6 |
@nicoddemus thanks for digging into that. I was thinking if it would make sense to have some sort of helper on I am willing to contribute, so if you could give me some pointers I could try getting this done. This is going to be the first time that I will be contribute and I still learning more about the source code of both pytest and pytest-xdist. Thank you |
While investigating a recent node id bug (pytest-dev#445) I decided to play with config initialization around the idea of initializing the config on the remote *exactly* we initialize the config object on pytest.main() One thing that immediately broke all tests was inprocess pytester runs, but other than that just a few tests failed which I find encouraging. While this patch is in no way even remotely ready, I would like to get opinions if the overall idea of initializing the config object like this is sound.
Hi @elyezer, Great to hear that you are considering contributing, we definitely appreciate it. 👍 But this topic in particular is not really recommended for newcomers to the project, as it involves a lot of complex iteration during the config initialization between pytest and pytest-xdist. Good news is that while I was debugging your report I decided to take the approach shown in #448 to fix the config initialization problem, and it looks promising. Hopefully I will find the time required to move this forward in the next few weeks. I suggest to take a look at other issues in the tracker that might be easier to get started. 👍 |
@nicoddemus I will keep a eye on it. Thank you for working on it. I will check other issues and hopefully no can start contributing sooner rather than later. Thank you very much |
Decided to keep the old way still working for now. Fix pytest-dev#6 Fix pytest-dev#445
Running
pytest
andpytest -n <executors>
does not produce the same nodeid for the tests and therefore this is preventing lastfailed from running properly. Since the nodeids in the cache don't match any test collected, it ends up running tests that are not meant to run.I have the following workflow:
-n
option--last-failed
option to try rerunning the failures to check if they are flaky. This is again without using xdist's-n
optionHere is the reproducer project structure:
Here are the file contents:
Considering the project described above, if you run
pytest -n <executors>
it shows the following (mind the tests' nodeids):But if we run without the
-n
option here is the output:As you can see both calls has the same rootdir but produce different nodeids for the tests. And if we check the cache for lastfailed:
pytest-xdist
test nodeid generation is not consistent with plain pytest nodeid generation and this inconsistency is breaking plugins such as thelastfailed
that relies on the nodeids to do its job.The text was updated successfully, but these errors were encountered: