Skip to content

Commit 74612ca

Browse files
author
Phil Varner
committed
refactor build to install only the defined dependencies of each workspace before tests
1 parent 907e3e1 commit 74612ca

File tree

11 files changed

+609
-15
lines changed

11 files changed

+609
-15
lines changed

.github/pull_request_template.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@
88

99
## Checklist
1010

11-
- [ ] Tests pass: `uv run pytest`
11+
- [ ] Tests pass: `./scripts/run-tests.sh`
1212
- [ ] Checks pass: `uv run pre-commit run --all-files`
1313
- [ ] CHANGELOG is updated (if necessary)

.github/workflows/ci.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
- name: Pre-Commit Hooks
3131
run: uv run pre-commit run --all-files
3232
- name: Test
33-
run: uv run pytest
33+
run: ./scripts/run-tests.sh
3434
- name: Validate test server
3535
run: uv run scripts/validate-stapi-fastapi
3636
- name: Docs

.pre-commit-config.yaml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,23 +7,20 @@ repos:
77
language: system
88
types: [python]
99
pass_filenames: false
10-
verbose: true
1110

1211
- id: ruff-format
1312
name: Format with ruff
1413
entry: uv run ruff format
1514
language: system
1615
types: [python]
1716
pass_filenames: false
18-
verbose: true
1917

2018
- id: mypy
2119
name: Check typing with mypy
2220
entry: uv run mypy
2321
language: system
2422
types: [python]
2523
pass_filenames: false
26-
verbose: true
2724

2825
- id: pymarkdown
2926
name: Markdownlint

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ uv sync
6262
Test:
6363

6464
```shell
65-
uv run pytest
65+
./scripts/run-tests.sh
6666
```
6767

6868
Check formatting and other lints:

pyproject.toml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,12 @@ dependencies = [
1414
[dependency-groups]
1515
dev = [
1616
"mypy>=1.15.0",
17-
"pytest>=8.3.5",
1817
"ruff>=0.11.2",
1918
"pymarkdownlnt>=0.9.25",
2019
"pre-commit>=4.2.0",
2120
"pre-commit-hooks>=5.0.0",
22-
# "fastapi[standard]>=0.115.12",
2321
"types-click>=7.1.8",
2422
"pygithub>=2.6.1",
25-
"respx>=0.22.0",
2623
]
2724
docs = [
2825
"mkdocs-material>=9.6.11",

pystapi-client/pyproject.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ readme = "README.md"
66
authors = [
77
{ name = "Kaveh Karimi-Asli", email = "[email protected]" },
88
{ name = "Philip Weiss", email = "[email protected]" },
9-
{ name = "Stella Reinhardt", email = "[email protected]"}
9+
{ name = "Stella Reinhardt", email = "[email protected]" },
1010
]
1111
maintainers = [{ name = "Pete Gadomski", email = "[email protected]" }]
1212
keywords = ["stapi"]
@@ -18,6 +18,8 @@ dependencies = [
1818
"python-dateutil>=2.8.2",
1919
"click>=8.1.8",
2020
]
21+
[dependency-groups]
22+
dev = ["pytest>=8.3.5", "respx>=0.22.0"]
2123

2224
[project.scripts]
2325
stapi = "pystapi_client.scripts.cli:cli"

scripts/run-tests.sh

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/usr/bin/env bash
2+
set -Eeuo pipefail
3+
# set -x # print each command before executing
4+
5+
for path in stapi-fastapi pystapi-validator pystapi-client stapi-pydantic; do
6+
name=$(basename "$path")
7+
8+
set +e
9+
uv sync --package "$name"
10+
uv run --package "$name" --directory "$path" pytest -p no:sugar
11+
code=$?
12+
set -e
13+
14+
case "$code" in
15+
0) : ;;
16+
5) echo " (no tests in $name, skipping)";;
17+
*) echo " pytest failed in $name (exit $code)"; exit "$code";;
18+
esac
19+
done

scripts/validate-stapi-fastapi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ set -e
55
scripts="$(cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
66
root=$(dirname "$scripts")
77

8-
uv run fastapi dev "$root/stapi-fastapi/tests/application.py" >/dev/null 2>&1 &
8+
uv run --package stapi-fastapi fastapi dev "$root/stapi-fastapi/tests/application.py" >/dev/null 2>&1 &
99
server_pid=$!
1010

1111
set +e

stapi-fastapi/pyproject.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,12 @@ dependencies = [
2424
"stapi-pydantic>=0.0.3",
2525
]
2626

27+
[dependency-groups]
28+
dev = [
29+
"fastapi[standard]>=0.115.0",
30+
"pytest>=8.3.5",
31+
]
32+
2733
[tool.hatch.build.targets.sdist]
2834
include = ["src/stapi_fastapi"]
2935

stapi-pydantic/pyproject.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@ authors = [
1010
requires-python = ">=3.11"
1111
dependencies = ["pydantic>=2.12", "cql2>=0.3.6", "geojson-pydantic>=1.2.0"]
1212

13+
[dependency-groups]
14+
dev = [
15+
"pytest>=8.3.5",
16+
]
17+
1318
[project.scripts]
1419
stapi-pydantic = "stapi_pydantic:main"
1520

0 commit comments

Comments
 (0)