mirror of
https://github.com/inventree/InvenTree.git
synced 2025-05-08 16:28:49 +00:00
feat(backend): record contexts for coverage (#9643)
* feat(backend): Record contexts for coverage * add docs
This commit is contained in:
parent
34db1a2a49
commit
0b228761b4
6
.github/workflows/qc_checks.yaml
vendored
6
.github/workflows/qc_checks.yaml
vendored
@ -342,6 +342,12 @@ jobs:
|
|||||||
run: python3 .github/scripts/check_migration_files.py
|
run: python3 .github/scripts/check_migration_files.py
|
||||||
- name: Coverage Tests
|
- name: Coverage Tests
|
||||||
run: invoke dev.test --coverage --translations
|
run: invoke dev.test --coverage --translations
|
||||||
|
- name: Upload raw coverage to artifacts
|
||||||
|
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # pin@v4.6.2
|
||||||
|
with:
|
||||||
|
name: coverage
|
||||||
|
path: .coverage
|
||||||
|
retention-days: 14
|
||||||
- name: Upload coverage reports to Codecov
|
- name: Upload coverage reports to Codecov
|
||||||
uses: codecov/codecov-action@ad3126e916f78f00edff4ed0317cf185271ccc2d # pin@v5.4.2
|
uses: codecov/codecov-action@ad3126e916f78f00edff4ed0317cf185271ccc2d # pin@v5.4.2
|
||||||
if: always()
|
if: always()
|
||||||
|
@ -199,6 +199,15 @@ alter user myuser createdb;
|
|||||||
!!! info "Devcontainer"
|
!!! info "Devcontainer"
|
||||||
The default database container which is provided in the devcontainer is already setup with the required permissions
|
The default database container which is provided in the devcontainer is already setup with the required permissions
|
||||||
|
|
||||||
|
### Trace coverage to specific tests
|
||||||
|
|
||||||
|
Sometimes it is valuable to get insights how many tests cover a specific statement and which ones do. coverage.py calls this information contexts. Contexts are automatically captured by the invoke task test (with coverage enabled) and can be rendered with below command into a HTML report.
|
||||||
|
```bash
|
||||||
|
coverage html -i
|
||||||
|
```
|
||||||
|
|
||||||
|
The coverage database is also generated in the CI-pipeline and exposd for 14 days as a artifact named `coverage`.
|
||||||
|
|
||||||
## Code Style
|
## Code Style
|
||||||
|
|
||||||
Code style is automatically checked as part of the project's CI pipeline on GitHub. This means that any pull requests which do not conform to the style guidelines will fail CI checks.
|
Code style is automatically checked as part of the project's CI pipeline on GitHub. This means that any pull requests which do not conform to the style guidelines will fail CI checks.
|
||||||
|
@ -102,6 +102,10 @@ generate-hashes=true
|
|||||||
|
|
||||||
[tool.coverage.run]
|
[tool.coverage.run]
|
||||||
source = ["src/backend/InvenTree", "InvenTree"]
|
source = ["src/backend/InvenTree", "InvenTree"]
|
||||||
|
dynamic_context = "test_function"
|
||||||
|
|
||||||
|
[tool.coverage.html]
|
||||||
|
show_contexts = true
|
||||||
|
|
||||||
[tool.djlint]
|
[tool.djlint]
|
||||||
ignore = "D018,H006,H008,H020,H021,H023,H025,H030,H031,T002"
|
ignore = "D018,H006,H008,H020,H021,H023,H025,H030,H031,T002"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user