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

Function test_entry_point_exit_code

tests/integration/test_integration.py:365–396  ·  view source on GitHub ↗
(tmpdir)

Source from the content-addressed store, hash-verified

363
364
365def test_entry_point_exit_code(tmpdir):
366 # type: (Any) -> None
367 setup_py = dedent(
368 """
369 from setuptools import setup
370
371 setup(
372 name='my_app',
373 version='0.0.0',
374 zip_safe=True,
375 packages=[''],
376 entry_points={'console_scripts': ['my_app = my_app:do_something']},
377 )
378 """
379 )
380
381 error_msg = "setuptools expects this to exit non-zero"
382
383 my_app = dedent(
384 """
385 def do_something():
386 return '%s'
387 """
388 % error_msg
389 )
390
391 with temporary_content({"setup.py": setup_py, "my_app.py": my_app}) as project_dir:
392 my_app_pex = os.path.join(str(tmpdir), "my_app.pex")
393 run_pex_command(args=[project_dir, "-o", my_app_pex]).assert_success()
394 so, rc = run_simple_pex(my_app_pex, env=make_env(PEX_SCRIPT="my_app"))
395 assert so.decode("utf-8").strip() == error_msg
396 assert rc == 1
397
398
399CI_multi_resolve_test = pytest.mark.skipif(

Callers

nothing calls this directly

Calls 8

temporary_contentFunction · 0.90
run_pex_commandFunction · 0.90
run_simple_pexFunction · 0.90
make_envFunction · 0.90
assert_successMethod · 0.80
stripMethod · 0.80
decodeMethod · 0.80
joinMethod · 0.45

Tested by

no test coverage detected