When my test runner starts, I want to set some stuff up (adjust sys.path, add some environment variables, start some global fixtures). What hook can I use to make these changes in each xdist process that is spawned?
I've tried overloading a couple of the normal pytest hooks, but they are run before the subprocesses are launched.
pytest_xdist has additional hooks that can be used in the conftest.py (list of hooks). The relevant hook for this purpose is pytest_configure_node(node)
, which is run after each new node is available and before it starts running tests.