MCPcopy
hub / github.com/pex-tool/pex / test_activate_interpreter_different_from_current

Function test_activate_interpreter_different_from_current

tests/test_pex.py:623–645  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

621
622
623def test_activate_interpreter_different_from_current():
624 # type: () -> None
625 with temporary_dir() as pex_root:
626 interp_version = PY311 if PY_VER == (3, 10) else PY310
627 custom_interpreter = PythonInterpreter.from_binary(
628 ensure_python_interpreter(interp_version)
629 )
630 pex_info = PexInfo.default()
631 pex_info.pex_root = pex_root
632 with temporary_dir() as pex_chroot:
633 pex_builder = PEXBuilder(
634 path=pex_chroot, interpreter=custom_interpreter, pex_info=pex_info
635 )
636 with make_bdist(interpreter=custom_interpreter) as bdist:
637 pex_builder.add_distribution(bdist)
638 pex_builder.set_entry_point("sys:exit")
639 pex_builder.freeze()
640
641 pex = PEX(pex_builder.path(), interpreter=custom_interpreter)
642 try:
643 pex._activate()
644 except SystemExit as e:
645 pytest.fail("PEX activation of %s failed with %s" % (pex, e))
646
647
648def test_execute_interpreter_dashc_program():

Callers

nothing calls this directly

Calls 12

add_distributionMethod · 0.95
set_entry_pointMethod · 0.95
freezeMethod · 0.95
pathMethod · 0.95
_activateMethod · 0.95
temporary_dirFunction · 0.90
PEXBuilderClass · 0.90
make_bdistFunction · 0.90
PEXClass · 0.90
from_binaryMethod · 0.80
defaultMethod · 0.45

Tested by

no test coverage detected