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

Function test_script

tests/integration/test_pex_entry_points.py:38–55  ·  view source on GitHub ↗
(tmpdir)

Source from the content-addressed store, hash-verified

36
37
38def test_script(tmpdir):
39 # type: (Any) -> None
40
41 pex = os.path.join(str(tmpdir), "pex")
42
43 # N.B.: `make_project` defines setuptools `scripts` for "hello_world" and "shell_script".
44 with make_project(
45 entry_points={"console_scripts": ["my_app = my_project.my_module:do_something"]},
46 ) as project:
47
48 run_pex_command(args=[project, "-c", "my_app", "-o", pex]).assert_success()
49 assert b"hello world!\n" == subprocess.check_output(args=[pex])
50
51 run_pex_command(args=[project, "-c", "hello_world", "-o", pex]).assert_success()
52 assert b"hello world from py script!\n" == subprocess.check_output(args=[pex])
53
54 run_pex_command(args=[project, "-c", "shell_script", "-o", pex]).assert_success()
55 assert b"hello world from shell script\n" == subprocess.check_output(args=[pex])
56
57
58def test_entry_point(tmpdir):

Callers

nothing calls this directly

Calls 4

make_projectFunction · 0.90
run_pex_commandFunction · 0.90
assert_successMethod · 0.80
joinMethod · 0.45

Tested by

no test coverage detected