File tree 4 files changed +18
-6
lines changed
4 files changed +18
-6
lines changed Original file line number Diff line number Diff line change @@ -17,6 +17,17 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
17
17
18
18
## [ Unreleased]
19
19
20
+ ### Added
21
+
22
+ - Added ` pytest-cov ` as dev dependency.
23
+ - Added ` branch=True ` to coverage configuration.
24
+
25
+ ### Changed
26
+
27
+ - Adjusted default ` pytest ` command line arguments to include ` pytest-cov ` flags, with the default not printing the report to the terminal.
28
+ - Changed ` just py test ` command to erase coverage before each run and to get rid of calling ` coverage ` directly in favor of ` pytest-cov ` .
29
+ - Always upload coverage html report in CI tests instead of just on failure.
30
+
20
31
## [ 2024.45]
21
32
22
33
### Changed
Original file line number Diff line number Diff line change @@ -125,7 +125,7 @@ jobs:
125
125
# https://hynek.me/articles/ditch-codecov-python/
126
126
- name: Run tests
127
127
run: |
128
- time coverage run -m pytest --durations 10 --reverse -p no:randomly -n auto --dist loadfile
128
+ time python -m pytest --durations 10 --reverse -p no:randomly -n auto --dist loadfile --cov={{ module_name }} --cov-report= --cov-config=pyproject.toml
129
129
python -m coverage html --skip-covered --skip-empty
130
130
python -m coverage report | sed 's/^/ /' >> $GITHUB_STEP_SUMMARY
131
131
# python -m coverage report --fail-under=100
@@ -135,7 +135,6 @@ jobs:
135
135
with:
136
136
name: {% raw %} coverage-report-${{ github.run_id }}{% endraw %}
137
137
path: htmlcov
138
- if: {% raw %} ${{ failure() }}{% endraw %}
139
138
140
139
types:
141
140
runs-on: ubuntu-latest
Original file line number Diff line number Diff line change @@ -42,10 +42,11 @@ lock *ARGS:
42
42
# Run tests using pytest within the 'app' container, with optional arguments
43
43
[no-cd]
44
44
test *ARGS:
45
+ @just docker command python -m coverage erase
45
46
{% - if include_vite %}
46
- @just docker run app "-e DJANGO_VITE_DEV_SERVER_HOST=node" coverage run -m pytest {% raw %} {{ ARGS }}{% endraw %}
47
+ @just docker run app "-e DJANGO_VITE_DEV_SERVER_HOST=node" python -m pytest {% raw %} {{ ARGS }}{% endraw %}
47
48
{% - else %}
48
- @just docker command coverage run -m pytest {% raw %} {{ ARGS }}{% endraw %}
49
+ @just docker command python -m pytest {% raw %} {{ ARGS }}{% endraw %}
49
50
{% - endif %}
50
51
51
52
# Run tests with Playwright debug mode enabled, in the 'app' container, with optional arguments
Original file line number Diff line number Diff line change @@ -71,6 +71,7 @@ dev = [
71
71
"playwright=={{ playwright_version }}",
72
72
"pre-commit",
73
73
"pytest",
74
+ "pytest-cov",
74
75
"pytest-django",
75
76
"pytest-is-running",
76
77
"pytest-playwright",
@@ -122,6 +123,7 @@ exclude_lines = [
122
123
]
123
124
124
125
[tool.coverage.run]
126
+ branch = true
125
127
omit = [
126
128
"*/node_modules/*",
127
129
"{{ module_name }}/*/migrations/*",
@@ -135,7 +137,6 @@ omit = [
135
137
"requirements.txt"
136
138
]
137
139
plugins = ["django_coverage_plugin"]
138
- source = ["{{ module_name }}"]
139
140
140
141
[tool.django-stubs]
141
142
django_settings_module = "{{ module_name }}.settings"
@@ -203,7 +204,7 @@ ignore_missing_model_attributes = true
203
204
204
205
[tool.pytest.ini_options]
205
206
DJANGO_SETTINGS_MODULE = "{{ module_name }}.settings"
206
- addopts = "--reuse-db -n auto --dist loadfile"
207
+ addopts = "--reuse-db -n auto --dist loadfile --cov={{ module_name }} --cov-report= --cov-config=pyproject.toml "
207
208
norecursedirs = ".* bin build dist *.egg htmlcov logs node_modules static templates venv"
208
209
python_files = "tests.py test_*.py *_tests.py"
209
210
You can’t perform that action at this time.
0 commit comments