pytest-xdist icon indicating copy to clipboard operation
pytest-xdist copied to clipboard

[Question] running `pytest-xdist` in a read-only system

Open codebydant opened this issue 1 year ago • 1 comments

Hi team,

Greetings.

I have a question regarding the plugin when running in a read-only system like Databricks job clusters. I have disabled __pycache__ creation when running pytest with:

PYTHONDONTWRITEBYTECODE=1 and sys.dont_write_bytecode = True.

The tests were running successfully, but when I tried to enable the pytest-xdist plugin support with the -n logical or -n auto argument, pytest is creating the __pycache__ directory again and my run failed. I am guessing this is related to the pytest-xdist plugin.

Do you know if there is a way to tell pytest-xdist no to generate the __pycache__ directory?

Aditional context

image

codebydant avatar Jan 18 '24 13:01 codebydant

i believe the PYTHONDONTWRITEBYTECODE env var should pass over to popen subprocesses

execnet has a flag for passing -B to python to ensure no bytecode is written but its not exposed easily for xdist

RonnyPfannschmidt avatar Jan 18 '24 14:01 RonnyPfannschmidt