(project_name, zip_safe)
| 288 | @pytest.mark.parametrize("zip_safe", (False, True)) |
| 289 | @pytest.mark.parametrize("project_name", ("my_project", "my-project")) |
| 290 | def test_pex_script(project_name, zip_safe): |
| 291 | # type: (str, bool) -> None |
| 292 | with make_bdist(name=project_name, zip_safe=zip_safe) as bdist: |
| 293 | env_copy = os.environ.copy() |
| 294 | env_copy["PEX_SCRIPT"] = "hello_world" |
| 295 | so, rc = run_simple_pex_test("", env=env_copy) |
| 296 | assert rc == 1, so.decode("utf-8") |
| 297 | assert b"Could not find script 'hello_world'" in so |
| 298 | |
| 299 | so, rc = run_simple_pex_test("", env=env_copy, dists=[bdist]) |
| 300 | assert rc == 0, so.decode("utf-8") |
| 301 | assert b"hello world" in so |
| 302 | |
| 303 | env_copy["PEX_SCRIPT"] = "shell_script" |
| 304 | so, rc = run_simple_pex_test("", env=env_copy, dists=[bdist]) |
| 305 | assert rc == 0, so.decode("utf-8") |
| 306 | assert b"hello world from shell script" in so |
| 307 | |
| 308 | |
| 309 | def test_pex_run(): |
nothing calls this directly
no test coverage detected