Skip to content

Commit 3e87dc8

Browse files
Added a new step to upload code coverage report to codecov (celery#793)
* Added ".vscode" to .gitignore * Added a new step to generate code coverage report * Added --cov-report term {posargs} * Skipping pypy for code coverage * Added code coverage config to pyproject.toml * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent 39a2e3f commit 3e87dc8

File tree

4 files changed

+37
-2
lines changed

4 files changed

+37
-2
lines changed

.github/workflows/test.yml

+13-1
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,18 @@ jobs:
4545
python -m pip install --upgrade pip
4646
python -m pip install tox tox-gh-actions
4747
- name: Test with tox
48-
run: tox
48+
run: |
49+
if [ "${{ matrix.python-version }}" != "pypy-3.10" ]; then
50+
tox -- --cov=django_celery_beat --cov-report=xml --no-cov-on-fail --cov-report term
51+
else
52+
tox
53+
fi
4954
env:
5055
DJANGO: ${{ matrix.django-version }}
56+
- name: Upload coverage reports to Codecov
57+
if: ${{ matrix.python-version != 'pypy-3.10' }}
58+
uses: codecov/codecov-action@v4
59+
with:
60+
fail_ci_if_error: true # optional (default = false)
61+
token: ${{ secrets.CODECOV_TOKEN }}
62+
verbose: true # optional (default = false)

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ Documentation/
2020
.project
2121
.pydevproject
2222
.idea/
23+
.vscode/
2324
.coverage
2425
celery/tests/cover/
2526
.ve*

pyproject.toml

+22
Original file line numberDiff line numberDiff line change
@@ -127,3 +127,25 @@ lint.pylint.allow-magic-value-types = [
127127
"str",
128128
]
129129
lint.pylint.max-args = 8 # Default: 5
130+
131+
[tool.coverage.run]
132+
branch = true
133+
cover_pylib = false
134+
include = [ "*django_celery_beat/*" ]
135+
omit = [ "django_celery_beat.tests.*" ]
136+
137+
[tool.coverage.report]
138+
exclude_lines = [
139+
"pragma: no cover",
140+
"if TYPE_CHECKING:",
141+
"except ImportError:",
142+
]
143+
omit = [
144+
"*/python?.?/*",
145+
"*/site-packages/*",
146+
"*/pypy/*",
147+
"*/.tox/*",
148+
"*/docker/*",
149+
"*/docs/*",
150+
"*/test_*.py",
151+
]

tox.ini

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ sitepackages = False
5151
recreate = False
5252
commands =
5353
pip list
54-
pytest -xv
54+
pytest -xv {posargs}
5555

5656

5757
[testenv:apicheck]

0 commit comments

Comments
 (0)