user197674
user197674

Reputation: 798

run setup in a subprocess created by xdist

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.

Upvotes: 1

Views: 717

Answers (1)

user78110
user78110

Reputation:

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

Upvotes: 1

Related Questions