Skip to content

Commit

Permalink
Upgrade pants, adjust dev docs, adjust tests for get-pants.sh scrip…
Browse files Browse the repository at this point in the history
…t name (#145)

This does a bunch of "modernisation" fixes:

- upgrades this repo to use Pants 2.18.1 (which upgrades black and thus requires reformatting some code)
- adjusts the developer docs in the Readme to reference pants, instead of tox (maybe the `tox.ini` could be entirely removed?)
- fixes what was previously `test_pantsup.py` to refer to the new/main `get-pants.sh` name
  • Loading branch information
huonw committed Dec 29, 2023
1 parent 6f13671 commit cf6e4cb
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 23 deletions.
2 changes: 1 addition & 1 deletion BUILD
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
shell_sources(name="scripts")

resources(name="scripts_as_resources", sources=["one_step_setup.sh", "pants", "pantsup.sh"])
resources(name="scripts_as_resources", sources=["one_step_setup.sh", "pants", "get-pants.sh"])
18 changes: 2 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,8 @@ Follow the instructions at https://www.pantsbuild.org/docs/installation.

### Development

We use [tox](https://testrun.org/tox/en/latest/) for test automation. To run the test suite and linters, invoke tox:
We use Pants for test automation (so recursive!). To run the test suite, linters and formatters:

```bash
$ tox
```

You may run certain checks (`environments` in tox) with `tox -e` (run `tox -a` to see all options):

```bash
$ tox -e format-run
$ tox -e lint
$ tox -e test
```

You may pass arguments to Pytest like this:

```bash
$ tox -e test -- -vv -k test_only_bootstraps_the_first_time
$ pants fmt lint check test ::
```
2 changes: 1 addition & 1 deletion pants.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[GLOBAL]
pants_version = "2.15.0rc5"
pants_version = "2.18.1"

backend_packages.add = [
"pants.backend.python",
Expand Down
2 changes: 1 addition & 1 deletion tests/test_pantsup.py → tests/test_get_pants.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
def test_installs_pants(tmp_path: Path) -> None:
cwd = os.getcwd()
proc = subprocess.run(
["/bin/bash", os.path.join(cwd, "pantsup.sh")],
["/bin/bash", os.path.join(cwd, "get-pants.sh")],
env={"HOME": str(tmp_path)},
capture_output=True,
)
Expand Down
4 changes: 0 additions & 4 deletions tests/test_one_step_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@


def test_runs_on_clean_directory(tmp_path: Path) -> None:

cwd = os.getcwd()

proc = subprocess.run(
Expand All @@ -23,7 +22,6 @@ def test_runs_on_clean_directory(tmp_path: Path) -> None:


def test_pin_version(tmp_path: Path) -> None:

cwd = os.getcwd()
env = os.environ.copy()
env["PANTS_VERSION"] = "2.11.0rc6"
Expand All @@ -46,7 +44,6 @@ def test_pin_version(tmp_path: Path) -> None:


def test_fails_if_pants_script_present(tmp_path: Path) -> None:

cwd = os.getcwd()
pants_script = tmp_path / "pants"
pants_script.touch()
Expand All @@ -60,7 +57,6 @@ def test_fails_if_pants_script_present(tmp_path: Path) -> None:


def test_fails_if_pants_toml_present(tmp_path: Path) -> None:

cwd = os.getcwd()
pants_toml = tmp_path / "pants.toml"
pants_toml.touch()
Expand Down

0 comments on commit cf6e4cb

Please sign in to comment.