MCPcopy Index your code
hub / github.com/pex-tool/pex / assert_boot

Function assert_boot

tests/integration/test_pex_bootstrapper.py:307–325  ·  view source on GitHub ↗
(python=None)

Source from the content-addressed store, hash-verified

305 run_pex_command(args=["psutil==5.9.0", "-o", pex]).assert_success()
306
307 def assert_boot(python=None):
308 # type: (Optional[str]) -> None
309 args = [python] if python else []
310 args.extend([pex, "-c", "import psutil, sys; print(sys.executable)"])
311 output = subprocess.check_output(args=args, stderr=subprocess.PIPE)
312
313 # N.B.: We expect the current interpreter the PEX was built with to be selected since the
314 # PEX contains a single platform specific distribution that only works with that
315 # interpreter. If the current interpreter is in a venv though, we expect the PEX bootstrap
316 # to have broken out of the venv and used its base system interpreter.
317 # See:
318 # https://github.com/pex-tool/pex/pull/1130
319 # https://github.com/pex-tool/pex/issues/1031
320 assert (
321 PythonInterpreter.get().resolve_base_interpreter()
322 == PythonInterpreter.from_binary(
323 str(output.decode("ascii").strip())
324 ).resolve_base_interpreter()
325 )
326
327 assert_boot()
328 assert_boot(sys.executable)

Callers 1

Calls 6

extendMethod · 0.80
from_binaryMethod · 0.80
stripMethod · 0.80
decodeMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected