I need to execute some setup (like creating a socket) inside each of the processes created by xdist before the processes start running the tests. I have looked at the hooks provided by xdist, but both pytest_configure_node()
and pytest_testnodeready()
seem to be executed by the main process instead of the subprocesses. Is there a way to do this?
Thanks.
the pytest_configure(config)
hook is also executed on the slaves
just check of there is a config.slaveinput
i recall there are some examples in the builtin junitxml plugin
edit: link to code: https://github.com/pytest-dev/pytest/blob/master/_pytest/junitxml.py#L225