https://pantsbuild.org/ logo
#pex
Title
# pex
r

red-balloon-89377

02/12/2019, 10:06 AM
I have been wrapping my head around the codebase, and I think I found an issue with the way environments are handled in integration tests. In the following integration test:
Copy code
def test_interpreter_constraints_honored_without_ppp_or_pp():
  # tox -e py35-integration -- -s -k test_interpreter_resolution_without_pex_python_path

  # Create a pex with interpreter constraints, but for not the default interpreter in the path.
  with temporary_dir() as td:
    py36_path = ensure_python_interpreter(PY36)

    pex_out_path = os.path.join(td, 'pex.pex')
    res = run_pex_command(['--disable-cache',
      '--interpreter-constraint===%s' % PY36,
      '-o', pex_out_path],
      env=make_env(
        PATH=os.path.dirname(py36_path),  # 3.6
        PEX_IGNORE_RCFILES='1'
      )
    )
    res.assert_success()
,
run_pex_command
calls
pex.py::main
, which reads environment variables from the global
ENV
instance of
Variables
. If I insert this call in the first line of `pex.py::main`:
Copy code
print("BL: Running bin/pex.py::main(). ENV._environ.get('PEX_IGNORE_RCFILES') = {}, os.environ.get('PEX_IGNORE_RCFILES') = {}".format( ENV._environ.get("PEX_IGNORE_RCFILES"), os.environ.get("PEX_IGNORE_RCFILES")))
, I get:
Copy code
BL: Running bin/pex.py::main(). ENV._environ.get('PEX_IGNORE_RCFILES') = None, os.environ.get('PEX_IGNORE_RCFILES') = 1
Should this be made into an issue along the lines of “Make sure we update
ENV
when running integration tests with custom envs”?