Skip to content

Commit

Permalink
tests: run both pip and uv tests
Browse files Browse the repository at this point in the history
Signed-off-by: Henry Schreiner <[email protected]>
  • Loading branch information
henryiii committed Oct 8, 2024
1 parent 403b1dd commit 6ca3376
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,10 @@ To use the [pre-commit](https://pre-commit.com) integration, put this in your
This requires your build dependencies, but in doing so, it can cache the
environment, making it quite fast. The installation is handled by pre-commit;
see [`pre-commit-uv`](https://pypi.org/p/pre-commit-uv) if you want to try to
optimize the initial setup. If you don't mind slower runs and don't want to
require a build dependency listing:
optimize the initial setup. If uv is present (including in your
`additional_dependencies`), the build will be slightly faster, as uv is used to
do the build. If you don't mind slower runs and don't want to require a build
dependency listing:

```yaml
- repo: https://github.com/henryiii/check-sdist
Expand Down
14 changes: 12 additions & 2 deletions tests/test_downstream.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,27 @@

from check_sdist.__main__ import compare
from check_sdist._compat import tomllib
from check_sdist.sdist import get_uv

DIR = Path(__file__).parent.resolve()

with DIR.joinpath("downstream.toml").open("rb") as f:
packages = tomllib.load(f)["packages"]


@pytest.mark.parametrize(
"installer",
[
pytest.param(
"uv", marks=pytest.mark.skipif(get_uv() is None, reason="uv not found")
),
"pip",
],
)
@pytest.mark.parametrize(
("repo", "ref", "fail"), [(x["repo"], x["ref"], x.get("fail", 0)) for x in packages]
)
def test_packages(repo, ref, fail, tmp_path, monkeypatch):
def test_packages(repo, ref, fail, tmp_path, monkeypatch, installer):
monkeypatch.chdir(tmp_path)
cmd = [
"git",
Expand All @@ -29,4 +39,4 @@ def test_packages(repo, ref, fail, tmp_path, monkeypatch):
]
subprocess.run(cmd, check=True)
package_path = tmp_path / repo.split("/")[1]
assert compare(package_path, isolated=True) == fail
assert compare(package_path, isolated=True, installer=installer) == fail

0 comments on commit 6ca3376

Please sign in to comment.