Skip to content

Commit 69aeb25

Browse files
authored
Started using pytest-cov (#263)
* Started using pytest-cov * Fix coverage report generation
1 parent 086f515 commit 69aeb25

4 files changed

Lines changed: 9 additions & 6 deletions

File tree

.github/workflows/ci.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,7 @@ jobs:
5252
run: docker compose -f docker-compose.local.yml run --rm django python manage.py migrate
5353

5454
- name: Test with Pytest and Coverage
55-
run: |
56-
docker compose -f docker-compose.local.yml run django coverage run -m pytest
57-
docker compose -f docker-compose.local.yml run django coverage xml
55+
run: docker compose -f docker-compose.local.yml run django coverage run -m pytest --cov=democrasite --cov-report=xml
5856

5957
- name: Send Coverage report to Codecov
6058
uses: codecov/codecov-action@v5

README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,6 @@ Test coverage
148148

149149
To run the tests, check your test coverage, and generate an HTML coverage report::
150150

151-
$ coverage run -m pytest
151+
$ pytest --cov=democrasite
152152
$ coverage html
153153
$ open htmlcov/index.html

pyproject.toml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,12 @@ norecursedirs = ["node_modules"]
88
# ==== Coverage ====
99
[tool.coverage.run]
1010
include = ["democrasite/**"]
11-
omit = ["*/migrations/*", "*/tests/*"]
11+
omit = [
12+
"*/migrations/*",
13+
"*/tests/*",
14+
"democrasite/templates/account/*",
15+
"democrasite/templates/socialaccount/*",
16+
]
1217
plugins = ["django_coverage_plugin"]
1318

1419
# ==== mypy ====

requirements/local.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ sphinxcontrib-django==2.5 # https://github.com/sphinx-doc/sphinxcontrib-django
2020
# Code quality
2121
# ------------------------------------------------------------------------------
2222
ruff==0.12.11 # https://github.com/astral-sh/ruff
23-
coverage==7.10.6 # https://github.com/nedbat/coveragepy
23+
pytest-cov==7.0.0 # https://github.com/pytest-dev/pytest-cov
2424
djlint==1.36.4 # https://github.com/Riverside-Healthcare/djLint
2525
pre-commit==4.3.0 # https://github.com/pre-commit/pre-commit
2626

0 commit comments

Comments
 (0)