Fixed an issue with running the same test multiple times sequentially#1091
Fixed an issue with running the same test multiple times sequentially#1091yuvalino wants to merge 2 commits intopytest-dev:masterfrom
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.