Skip to content

Commit f73f8e3

Browse files
committed
Collect unit test coverage
1 parent e86b3a6 commit f73f8e3

16 files changed

+215
-312
lines changed

.config/.coveragerc

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
[run]
2+
branch = true
3+
parallel = true
4+
relative_files = true
5+
context = ${COVERAGE_CONTEXT}
6+
7+
[report]
8+
exclude_lines =
9+
pragma: no cover
10+
raise NotImplementedError
11+
if TYPE_CHECKING:
12+
13+
[paths]
14+
source =
15+
src/python_minifier
16+
*/site-packages/python_minifier

.config/.coveragerc-legacy

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
[run]
2+
branch = true
3+
parallel = true
4+
5+
[report]
6+
exclude_lines =
7+
pragma: no cover
8+
raise NotImplementedError
9+
if TYPE_CHECKING:
10+
11+
[paths]
12+
source =
13+
src/python_minifier
14+
*/site-packages/python_minifier

.github/workflows/test.yaml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,14 @@ jobs:
3434
run: |
3535
tox -r -e $(echo "${{ matrix.python }}" | tr -d .)
3636
37+
- name: Upload coverage
38+
if: ${{ matrix.python != 'python3.3' && matrix.python != 'python3.4' }}
39+
uses: actions/upload-artifact@v4
40+
with:
41+
name: coverage-${{ matrix.python }}
42+
path: .coverage.*
43+
include-hidden-files: true
44+
3745
test-windows:
3846
name: Test Windows
3947
runs-on: windows-2025
@@ -155,3 +163,54 @@ jobs:
155163
with:
156164
dockerfile: ./docker/${{ matrix.dockerfile }}
157165
config: .config/hadolint.yaml
166+
167+
coverage-report:
168+
name: Coverage Report
169+
runs-on: ubuntu-24.04
170+
needs: test
171+
steps:
172+
- name: Checkout
173+
uses: actions/[email protected]
174+
with:
175+
fetch-depth: 1
176+
show-progress: false
177+
persist-credentials: false
178+
179+
- name: Download coverage artifacts
180+
uses: actions/download-artifact@v4
181+
with:
182+
pattern: coverage-*
183+
merge-multiple: true
184+
185+
- name: Set up Python
186+
uses: actions/setup-python@v5
187+
with:
188+
python-version: '3.14'
189+
190+
- name: Install coverage
191+
run: pip install coverage
192+
193+
- name: Combine coverage
194+
run: |
195+
ls -la .coverage*
196+
coverage combine --rcfile=.config/.coveragerc
197+
ls -la .coverage*
198+
199+
- name: Upload combined coverage
200+
uses: actions/upload-artifact@v4
201+
with:
202+
name: coverage-combined
203+
path: .coverage
204+
include-hidden-files: true
205+
206+
- name: Generate report
207+
run: |
208+
coverage report --rcfile=.config/.coveragerc --format=markdown 2>&1 | tee coverage-report.md
209+
cat coverage-report.md >> "$GITHUB_STEP_SUMMARY"
210+
coverage html --rcfile=.config/.coveragerc
211+
212+
- name: Upload HTML report
213+
uses: actions/upload-artifact@v4
214+
with:
215+
name: coverage-html-report
216+
path: htmlcov/

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,4 @@ docs/source/transforms/*.min.py
1818
.circleci-config.yml
1919
.coverage
2020
.mypy_cache/
21+
.tox/

tox-windows.ini

Lines changed: 2 additions & 117 deletions
Original file line numberDiff line numberDiff line change
@@ -1,154 +1,39 @@
11
[tox]
2-
envlist = 3.8,3.9,3.10,3.11,3.12,3.13,3.14
2+
envlist = 2.7,3.6,3.7,3.8,3.9,3.10,3.11,3.12,3.13,3.14
33

44
[testenv]
5+
deps = -r{toxinidir}/tox/python{envname}-windows-requirements.txt
56
commands =
67
pytest {posargs:test} --junitxml=junit-python{envname}.xml --verbose
78

89
[testenv:2.7]
910
basepython = python2.7
10-
deps =
11-
atomicwrites==1.4.1
12-
attrs==21.4.0
13-
backports.functools-lru-cache==1.6.6
14-
colorama==0.4.6
15-
configparser==4.0.2
16-
contextlib2==0.6.0.post1
17-
funcsigs==1.0.2
18-
importlib-metadata==2.1.3
19-
more-itertools==5.0.0
20-
packaging==20.9
21-
pathlib2==2.3.7.post1
22-
pluggy==0.13.1
23-
py==1.11.0
24-
pyparsing==2.4.7
25-
pytest==4.6.11
26-
PyYAML==5.4.1
27-
scandir==1.10.0
28-
six==1.17.0
29-
typing==3.10.0.0
30-
wcwidth==0.2.13
31-
zipp==1.2.0
3211

3312
[testenv:3.6]
3413
basepython = python3.6
35-
deps =
36-
atomicwrites==1.4.1
37-
attrs==22.2.0
38-
colorama==0.4.5
39-
importlib-metadata==4.8.3
40-
iniconfig==1.1.1
41-
packaging==21.3
42-
pluggy==1.0.0
43-
py==1.11.0
44-
pyparsing==3.1.4
45-
pytest==7.0.1
46-
PyYAML==6.0.1
47-
tomli==1.2.3
48-
typing_extensions==4.1.1
49-
zipp==3.6.0
5014

5115
[testenv:3.7]
5216
basepython = python3.7
53-
deps =
54-
colorama==0.4.6
55-
exceptiongroup==1.3.0
56-
importlib-metadata==6.7.0
57-
iniconfig==2.0.0
58-
packaging==24.0
59-
pip==24.0
60-
pluggy==1.2.0
61-
pytest==7.4.4
62-
PyYAML==6.0.1
63-
setuptools==68.0.0
64-
tomli==2.0.1
65-
typing_extensions==4.7.1
66-
wheel==0.42.0
67-
zipp==3.15.0
6817

6918
[testenv:3.8]
7019
basepython = python3.8
71-
deps =
72-
atomicwrites==1.4.1
73-
attrs==20.3.0
74-
more-itertools==10.5.0
75-
pluggy==0.13.1
76-
py==1.11.0
77-
pytest==4.5.0
78-
PyYAML==5.1
79-
setuptools==45.3.0
80-
six==1.16.0
81-
wcwidth==0.2.13
8220

8321
[testenv:3.9]
8422
basepython = python3.9
85-
deps =
86-
exceptiongroup==1.2.2
87-
iniconfig==2.0.0
88-
packaging==24.1
89-
pluggy==1.5.0
90-
pytest==8.3.3
91-
PyYAML==6.0.2
92-
tomli==2.0.1
9323

9424
[testenv:3.10]
9525
basepython = python3.10
9626
setenv =
9727
PIP_CONSTRAINT={toxinidir}/tox/pyyaml-5.4.1-constraints.txt
98-
deps =
99-
attrs==24.2.0
100-
iniconfig==2.0.0
101-
packaging==24.1
102-
pluggy==0.13.1
103-
py==1.11.0
104-
pyperf==2.2.0
105-
pytest==6.2.4
106-
PyYAML==5.4.1
107-
toml==0.10.2
10828

10929
[testenv:3.11]
11030
basepython = python3.11
111-
deps =
112-
attrs==24.2.0
113-
iniconfig==2.0.0
114-
packaging==24.1
115-
pluggy==1.5.0
116-
py==1.11.0
117-
pyperf==2.4.1
118-
pytest==7.1.2
119-
PyYAML==6.0
120-
tomli==2.0.1
12131

12232
[testenv:3.12]
12333
basepython = python3.12
124-
deps =
125-
iniconfig==2.0.0
126-
packaging==24.1
127-
pluggy==1.5.0
128-
psutil==6.0.0
129-
pyperf==2.6.1
130-
pytest==7.4.2
131-
PyYAML==6.0.1
13234

13335
[testenv:3.13]
13436
basepython = python3.13
135-
deps =
136-
iniconfig==2.0.0
137-
packaging==24.1
138-
pluggy==1.5.0
139-
psutil==6.0.0
140-
pyperf==2.7.0
141-
pytest==8.3.3
142-
PyYAML==6.0.2
14337

14438
[testenv:3.14]
14539
basepython = python3.14
146-
deps =
147-
colorama==0.4.6
148-
iniconfig==2.1.0
149-
packaging==25.0
150-
pip==25.2
151-
pluggy==1.6.0
152-
Pygments==2.19.2
153-
pytest==8.4.1
154-
PyYAML==6.0.2

0 commit comments

Comments
 (0)