pex execution mode for pytest? I'm wondering does ...
# general
b
pex execution mode for pytest? I'm wondering does this default to execution_mode="venv"? Asking as I had an issue with a pex binary that attempted to do ray.init() and failed with 'could not import ray'. This was resolved once I set 'execution_mode=venv'. The test code had no such issue but does not have the explicit directive.
g
Could be related to this? https://github.com/pantsbuild/pants/issues/20205. I'm not sure if pytest runs like python_source, but I'd imagine it's closer.
(The root cause of that -- and similar -- is generally malformed namespace packages.)
b
Thanks. That sounds very plausible****. (I did not really stop to think that running pytest is not really comparable to running the package target in the first place anyway, even if they are both pex files.) ** "i_n short, there are a lot of projects that should be using namespace packages but don't (correctly). The whole issue of namespace packages is sidestepped in a venv where there is effectively 1_
sys.path
entry._Since most users of most packages in the wild use venvs (or system packages with similar layout), these issues are often hidden until..... PEX etc_"