Skip to content
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

No "master" worker_id in session fixture #1029

Open
andrewVolodko opened this issue Feb 28, 2024 · 0 comments
Open

No "master" worker_id in session fixture #1029

andrewVolodko opened this issue Feb 28, 2024 · 0 comments

Comments

@andrewVolodko
Copy link

andrewVolodko commented Feb 28, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant