-
Notifications
You must be signed in to change notification settings - Fork 232
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
Fixed an issue with running the same test multiple times sequentially #1091
base: master
Are you sure you want to change the base?
Conversation
When pytest_runtest_protocol is called with item==nextitem multiple times, with a test that accepts some fixtures -> the second call forward raises an error. This is caused in WorkerInteractor when the same test appears twice in a row in the queue. So if this specific case occurs, ensure nextitem is called with None instead.
for more information, see https://pre-commit.ci
I am assuming you are using a plugin which does this. Which plugin is it? |
This is a custom xdist scheduler I'm working on. I've wrote a workaround for now: |
Thanks @yuvalino however we also will need a regression test for your change for this to be considered for merging. |
But what's the error exactly? Is it raised by xdist or pytest core?
|
@amezin exception is raised by the pytest core, the fixtures are not passed to the "nextitem", so the invocation of the second runtest_protocol fails. @nicoddemus please explain better what do you mean? as far as I'm aware, no scenario where the same (which is not the case in pytest-repeat) item is executed twice in a row over xdist so there's no regression there, nor in any other use-case of xdist. I've finished my work by developing multiple plugins (pytest-publish, pytest-xstress) and have come with a final, new vision for tests: https://github.com/yuvalino/pytest-infinity Please help me get this fix out to mainline xdist :) |
Shouldn't the fix be implemented in pytest core then? Also, could you show the exact error - message, stack trace? |
When pytest_runtest_protocol is called with item==nextitem multiple times, with a test that accepts some fixtures -> the second call forward raises an error.
This is caused in WorkerInteractor when the same test appears twice in a row in the queue.
So if this specific case occurs, ensure nextitem is called with None instead.