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

Function test_run_pex

tests/test_pex_binary.py:212–240  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

210
211
212def test_run_pex():
213 # type: () -> None
214
215 def assert_run_pex(python=None, pex_args=None):
216 # type: (Optional[str], Optional[List[str]]) -> List[Text]
217 pex_args = list(pex_args) if pex_args else []
218 results = run_pex_command(
219 python=python,
220 args=pex_args
221 + ["ansicolors==1.1.8", "--", "-c", 'import colors; print(" ".join(colors.COLORS))'],
222 quiet=True,
223 )
224 results.assert_success()
225 assert "black red green yellow blue magenta cyan white" == results.output.strip()
226 return results.error.splitlines()
227
228 incompatible_platforms_warning_msg = (
229 "WARNING: attempting to run PEX with incompatible platforms!"
230 )
231
232 assert incompatible_platforms_warning_msg not in assert_run_pex()
233 assert incompatible_platforms_warning_msg not in assert_run_pex(pex_args=["--platform=current"])
234 assert incompatible_platforms_warning_msg not in assert_run_pex(
235 pex_args=["--platform={}".format(PythonInterpreter.get().platform)]
236 )
237
238 py39 = ensure_python_interpreter(PY39)
239 stderr_lines = assert_run_pex(python=py39, pex_args=["--platform=macosx-10.13-x86_64-cp-37-m"])
240 assert incompatible_platforms_warning_msg in stderr_lines

Callers

nothing calls this directly

Calls 3

assert_run_pexFunction · 0.85
getMethod · 0.45

Tested by

no test coverage detected