Skip to content

Commit 6f0606f

Browse files
committed
add code coverage check
1 parent 7a35463 commit 6f0606f

File tree

3 files changed

+31
-2
lines changed

3 files changed

+31
-2
lines changed

.github/workflows/ci.yml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,18 @@ jobs:
6363
6464
- name: Run Tests
6565
run: |
66-
python -Wa manage.py test tests
66+
coverage run --source='publications' --omit='*/migrations/**' manage.py test tests
67+
68+
- name: Save coverage to files
69+
run: |
70+
coverage html
71+
coverage xml
72+
73+
- name: Get code coverage
74+
uses: orgoro/coverage@v3.2
75+
with:
76+
coverageFile: coverage.xml
77+
token: ${{ secrets.GITHUB_TOKEN }}
6778

6879
uitests:
6980
# disable until UI tests are fixed, see https://github.com/GeoinformationSystems/optimap/issues/142

README.md

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,13 +261,30 @@ python -Wa manage.py test
261261

262262
# configure logging level for cleaner test progress output
263263
OPTIMAP_LOGGING_LEVEL=WARNING python manage.py test tests
264+
```
265+
266+
### Run UI tests
267+
268+
Running UI tests needs either compose configuration or a manage.py runserver in a seperate shell.
264269

265-
# running UI tests needs either compose configuration or a manage.py runserver in a seperate shell
270+
```bash
266271
docker-compose up --build
267272

268273
python -Wa manage.py test tests-ui
269274
```
270275

276+
### Check test coverage
277+
278+
```bash
279+
coverage run --source='publications' --omit='*/migrations/**' manage.py test tests
280+
281+
coverage report
282+
283+
# save the reports
284+
coverage html
285+
coverage xml
286+
```
287+
271288
### Develop tests
272289

273290
For developing the UI tests, you can remove the `headless=True` in the statements for starting the browsers so you can "watch along" and inspect the HTML when a breakpoint is hit as the tests are executed.

requirements-dev.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ pyvirtualdisplay
33
responses
44
xmldiff
55
fiona
6+
coverage

0 commit comments

Comments
 (0)