Skip to content

Commit

Permalink
additional tests for existing get_pants.sh functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
huonw committed Feb 12, 2024
1 parent 4036add commit 5f759a7
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions tests/test_get_pants.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,27 @@ def test_installs_pants_when_no_args(tmp_path: Path) -> None:
assert b"Installed the pants launcher from" in proc.stderr

_check_launcher_runs(tmp_path / ".local" / "bin" / "pants")


def test_installs_specific_version_when_version_arg(tmp_path: Path) -> None:
_run(home=tmp_path, args=["--version", "0.10.0"])
_check_launcher_runs(tmp_path / ".local" / "bin" / "pants", expected_version="0.10.0")


def test_fails_with_error_when_incorrect_version_arg(tmp_path: Path) -> None:
# we've moved past 0.1.x and never did quite this many patch releases.
proc = _run(home=tmp_path, args=["--version", "0.1.99999"], check=False)
assert proc.returncode != 0
assert proc.stdout == b""
assert b"The requested URL returned error: 404" in proc.stderr


def test_installs_to_specific_dir_when_bin_dir_arg(tmp_path: Path) -> None:
custom = tmp_path / "custom"
_run(home=tmp_path, args=["--bin-dir", str(custom)])
_check_launcher_runs(custom / "pants")


def test_installs_with_base_name_when_base_name_arg(tmp_path: Path) -> None:
_run(home=tmp_path, args=["--base-name", "other-name"])
_check_launcher_runs(tmp_path / ".local" / "bin" / "other-name")

0 comments on commit 5f759a7

Please sign in to comment.