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

Function run_pex_command

testing/__init__.py:571–598  ·  view source on GitHub ↗

Simulate running pex command for integration testing. This is different from run_simple_pex in that it calls the pex command rather than running a generated pex. This is useful for testing end to end runs with specific command line arguments or env options.

(
    args,  # type: Iterable[str]
    env=None,  # type: Optional[Dict[str, str]]
    python=None,  # type: Optional[Union[str, UvPython]]
    quiet=None,  # type: Optional[bool]
    cwd=None,  # type: Optional[str]
    pex_module="pex",  # type: str
    use_pex_whl_venv=True,  # type: bool
)

Source from the content-addressed store, hash-verified

569
570
571def run_pex_command(
572 args, # type: Iterable[str]
573 env=None, # type: Optional[Dict[str, str]]
574 python=None, # type: Optional[Union[str, UvPython]]
575 quiet=None, # type: Optional[bool]
576 cwd=None, # type: Optional[str]
577 pex_module="pex", # type: str
578 use_pex_whl_venv=True, # type: bool
579):
580 # type: (...) -> IntegResults
581 """Simulate running pex command for integration testing.
582
583 This is different from run_simple_pex in that it calls the pex command rather than running a
584 generated pex. This is useful for testing end to end runs with specific command line arguments
585 or env options.
586 """
587 if isinstance(python, UvPython):
588 python = ensure_uv_python(python)
589 cmd = create_pex_command(
590 args, python=python, quiet=quiet, pex_module=pex_module, use_pex_whl_venv=use_pex_whl_venv
591 )
592 process = Executor.open_process(
593 cmd=cmd, env=env, cwd=cwd, stdout=subprocess.PIPE, stderr=subprocess.PIPE
594 )
595 output, error = process.communicate()
596 return IntegResults(
597 tuple(cmd), output.decode("utf-8"), error.decode("utf-8"), process.returncode
598 )
599
600
601def run_simple_pex(

Callers 15

createFunction · 0.90
test_build_pexFunction · 0.90
assert_run_pexFunction · 0.90
pexFunction · 0.90
test_venv_copiesFunction · 0.90
test_relocatable_venvFunction · 0.90
test_compileFunction · 0.90
create_pex_venvFunction · 0.90
test_custom_promptFunction · 0.90

Calls 6

ensure_uv_pythonFunction · 0.85
create_pex_commandFunction · 0.85
IntegResultsClass · 0.85
communicateMethod · 0.80
decodeMethod · 0.80
open_processMethod · 0.45

Tested by 15

createFunction · 0.72
test_build_pexFunction · 0.72
assert_run_pexFunction · 0.72
pexFunction · 0.72
test_venv_copiesFunction · 0.72
test_relocatable_venvFunction · 0.72
test_compileFunction · 0.72
create_pex_venvFunction · 0.72
test_custom_promptFunction · 0.72