Add zip of picamera coverage and update CI to use it

This commit is contained in:
Julian Stirling 2025-07-29 16:03:30 +01:00
parent 9f38b041a6
commit 727d683c48
5 changed files with 24 additions and 5 deletions

3
.gitignore vendored
View file

@ -50,6 +50,9 @@ nosetests.xml
coverage.xml
report.xml
pytest_report.xml
.coverage.picamera
.coverage.main
picamera_test_hashes.json
# Translations
*.mo

View file

@ -130,15 +130,31 @@ pytest:
- git config --global user.name "Sir Unit of Test"
- git config --global user.email "fake@email.no"
- pytest
- mv .coverage .coverage.main
# --gitlab-code-quality-report=pytest-warnings.json # can restore when it installs ok
coverage: '/(?i)total.*? (100(?:\.0+)?\%|[1-9]?\d(?:\.\d+)?\%)$/'
artifacts:
when: always
paths:
- report.xml
- .coverage.main
# Combine CI coverage with coverage from Picamera
combined-tests:
stage: testing
extends: .python
needs:
- job: pytest
artifacts: true
script:
- ./picamera_tests.py unzip
- coverage combine
- coverage report
- coverage xml
coverage: '/(?i)total.*? (100(?:\.0+)?\%|[1-9]?\d(?:\.\d+)?\%)$/'
artifacts:
when: always
reports:
junit: report.xml
# codequality: pytest-warnings.json
coverage_report:
coverage_format: cobertura
path: coverage.xml

View file

@ -10,7 +10,7 @@ It is essential to stop the server first:
However, this will not archive the tests in the Git repository for reporting the coverage. For this see the section below on reporting the coverage.
When writing and debugging these unit tests it is often best to run a specific test and to use the `-s` flag to see the print statments. It is also often useful to use `--pdb` to drop you into a python debug session on any failure. For example, you might run:
When writing and debugging these unit tests it is often best to run a specific test and to use the `-s` flag to see the print statements. It is also often useful to use `--pdb` to drop you into a python debug session on any failure. For example, you might run:
/picamera2/test_exposure_time_drift.py::test_exposure_time_saves_and_loads -s --pdb

BIN
picamera_coverage.zip Normal file

Binary file not shown.

View file

@ -25,14 +25,14 @@ HASHED_FILES = [
def _get_hashes(include_coverage=False):
"""Return a dictonary of Git hashes for the HASHED FILES.
"""Return a dictionary of Git hashes for the HASHED FILES.
The key is the posixpath to the file so matching works even if the dictionary is
compared to a dictionary created on another system.
The coverage file is hashed when running for debug purposes.
Git hashes are so the files are line ending indpendent.
Git hashes are so the files are line ending independent.
"""
hashes = {}
filepaths = HASHED_FILES