pytest-xdist
pytest-xdist copied to clipboard
No "master" worker_id in session fixture
I want to perform the particular action only once per test run. As mentioned here, it can be done by checking, that now it's a master worker. https://pytest-xdist.readthedocs.io/en/latest/how-to.html#making-session-scoped-fixtures-execute-only-once
But there is no worker with id = "master".
Here is my code:
@fixture(scope="session", autouse=True)
def session_setup(self, worker_id):
if worker_id == "master":
print()
BTW, there is no master worker only when I'm running tests in parallel with flag -n 2 or more.