Skip to content

Commit e74bc28

Browse files
committed
Contrib unit tests separation
1 parent ec09ce0 commit e74bc28

File tree

2 files changed

+47
-20
lines changed

2 files changed

+47
-20
lines changed
Lines changed: 46 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: CI / Integrations / Tests
1+
name: CI / Contrib / Tests
22

33
on:
44
push:
@@ -14,49 +14,69 @@ permissions:
1414
id-token: write
1515

1616
jobs:
17-
integration_matrix:
17+
contrib_matrix:
1818
name: "${{ matrix.target.label }} / py${{ matrix.python-version }}"
1919
runs-on: ubuntu-latest
2020
strategy:
2121
matrix:
2222
target:
23-
- integration: aiohttp
23+
- contrib: aiohttp
24+
integration_path: tests/integration/contrib/aiohttp
25+
unit_path: tests/unit/contrib/aiohttp
2426
spec: ">=3.8,<4.0"
2527
label: "aiohttp-3.x"
26-
- integration: aiohttp
28+
- contrib: aiohttp
29+
integration_path: tests/integration/contrib/aiohttp
30+
unit_path: tests/unit/contrib/aiohttp
2731
spec: ">=3.11,<4.0"
2832
label: "aiohttp-3.11+"
29-
- integration: django
33+
- contrib: django
34+
integration_path: tests/integration/contrib/django
35+
unit_path: tests/unit/contrib/django
3036
spec: ">=4.0,<5.0"
3137
label: "django-4.x"
32-
- integration: django
38+
- contrib: django
39+
integration_path: tests/integration/contrib/django
40+
unit_path: tests/unit/contrib/django
3341
spec: ">=5.0,<6.0"
3442
label: "django-5.x"
35-
- integration: falcon
43+
- contrib: falcon
44+
integration_path: tests/integration/contrib/falcon
3645
spec: ">=4.0,<5.0"
3746
label: "falcon-4.x"
38-
- integration: fastapi
47+
- contrib: fastapi
48+
integration_path: tests/integration/contrib/fastapi
3949
spec: ">=0.111,<0.120"
4050
label: "fastapi-0.11x"
41-
- integration: fastapi
51+
- contrib: fastapi
52+
integration_path: tests/integration/contrib/fastapi
4253
spec: ">=0.120,<0.129"
4354
label: "fastapi-0.12x"
44-
- integration: flask
55+
- contrib: flask
56+
integration_path: tests/integration/contrib/flask
57+
unit_path: tests/unit/contrib/flask
4558
spec: ">=2.0,<3.0"
4659
label: "flask-2.x"
47-
- integration: flask
60+
- contrib: flask
61+
integration_path: tests/integration/contrib/flask
62+
unit_path: tests/unit/contrib/flask
4863
spec: ">=3.0,<4.0"
4964
label: "flask-3.x"
50-
- integration: requests
65+
- contrib: requests
66+
integration_path: tests/integration/contrib/requests
67+
unit_path: tests/unit/contrib/requests
5168
spec: ""
5269
label: "requests-default"
53-
- integration: starlette
70+
- contrib: starlette
71+
integration_path: tests/integration/contrib/starlette
5472
spec: ">=0.40.0,<0.50.0"
5573
label: "starlette-0.4x"
56-
- integration: starlette
74+
- contrib: starlette
75+
integration_path: tests/integration/contrib/starlette
5776
spec: ">=0.50.0,<0.60.0"
5877
label: "starlette-0.5x"
59-
- integration: werkzeug
78+
- contrib: werkzeug
79+
integration_path: tests/integration/contrib/werkzeug
6080
spec: ""
6181
label: "werkzeug-default"
6282
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
@@ -97,15 +117,22 @@ jobs:
97117

98118
- name: Install framework variant
99119
if: matrix.target.spec != ''
100-
run: poetry run pip install "${{ matrix.target.integration }}${{ matrix.target.spec }}"
120+
run: poetry run pip install "${{ matrix.target.contrib }}${{ matrix.target.spec }}"
101121

102122
- name: Test
123+
shell: bash
103124
env:
104125
PYTEST_ADDOPTS: "--color=yes"
105-
run: poetry run pytest tests/integration/contrib/${{ matrix.target.integration }}
126+
run: |
127+
paths=("${{ matrix.target.integration_path }}")
128+
unit_path="${{ matrix.target.unit_path }}"
129+
if [ -d "$unit_path" ]; then
130+
paths+=("$unit_path")
131+
fi
132+
poetry run pytest "${paths[@]}"
106133
107134
- name: Upload coverage
108135
uses: codecov/codecov-action@v5
109136
with:
110-
flags: integration,${{ matrix.target.integration }},${{ matrix.target.label }},py${{ matrix.python-version }}
111-
name: integration-${{ matrix.target.integration }}-${{ matrix.target.label }}-py${{ matrix.python-version }}
137+
flags: contrib,${{ matrix.target.contrib }},${{ matrix.target.label }},py${{ matrix.python-version }}
138+
name: contrib-${{ matrix.target.contrib }}-${{ matrix.target.label }}-py${{ matrix.python-version }}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ jobs:
5656
- name: Test
5757
env:
5858
PYTEST_ADDOPTS: "--color=yes"
59-
run: poetry run pytest --ignore=tests/integration/contrib
59+
run: poetry run pytest --ignore=tests/integration/contrib --ignore=tests/unit/contrib
6060

6161
- name: Static type check
6262
run: poetry run mypy

0 commit comments

Comments
 (0)