https://pantsbuild.org/ logo
#general
Title
# general
w

wide-zoo-86070

04/27/2022, 12:28 AM
Hi team. when I inspect the env var in a test running by Pants, I found both PATH (which include conda that just contains python) and _VIRTUAL_ENV_ are presented. I guess Pants/Pex reply on the _VIRTUAL_ENV._ However, if the test spawn a new process which inherit all the env vars, the process will use the conda env from PATH instead of the _VIRTUAL_ENV_. I am wondering how to handle this case?
one solution I have is to prefix the PATH with the _VIRTUAL_ENV_ before spawning the new process.
w

witty-crayon-22786

04/27/2022, 8:58 PM
the
VIRTUAL_ENV
which is present in the test environment is dynamically created by the PEX process: it should not be associated with your external environment at all
Pants sandboxes the processes that are run: one exception to that currently is the
PATH
, just because so many binaries which tests usually need are in the
PATH
.
it would be good to file a ticket describing what you are trying to do with
conda
inside of the test, and how you would expect it to work: my expectation is that tools like
conda
would/should not work at all when run inside the sandbox, but understanding the usecase would help.
2 Views