In my conftest.py i have pytest_configuration hook that runs some APIs before executing tests to configure stuff. All is working as expected until i use pytest-xdist to run tests in parallel. In this case, my hook is executed n+1 times, according to the number of nodes i select.
Is there a solution for the problem? I only need the configuration to execute once.
pytest_configuration(config):
option = config.getoption("--option_to_run_stuff")
if option == "1":
do_stuff()