Skip to content

Commit

Permalink
tests: add test for filename
Browse files Browse the repository at this point in the history
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
  • Loading branch information
henryiii committed Jan 10, 2024
1 parent 0cc0a97 commit 72388ea
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions tests/test_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,25 @@ def test_run_with_requirements_old(caplog, pipx_temp_env, tmp_path):
run_pipx_cli_exit(["run", script.as_uri()])


@mock.patch("os.execvpe", new=execvpe_mock)
def test_run_correct_traceback(capfd, pipx_temp_env, tmp_path):
script = tmp_path / "test.py"
script.write_text(
textwrap.dedent(
f"""
raise RuntimeError("Should fail")
"""
).strip()
)

with pytest.raises(SystemExit):
run_pipx_cli(["run", str(script)])

captured = capfd.readouterr()
assert "test.py" in captured.err



@mock.patch("os.execvpe", new=execvpe_mock)
def test_run_with_args(caplog, pipx_temp_env, tmp_path):
script = tmp_path / "test.py"
Expand Down

0 comments on commit 72388ea

Please sign in to comment.