Add zip of picamera coverage and update CI to use it
This commit is contained in:
parent
9f38b041a6
commit
727d683c48
5 changed files with 24 additions and 5 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
|
@ -50,6 +50,9 @@ nosetests.xml
|
||||||
coverage.xml
|
coverage.xml
|
||||||
report.xml
|
report.xml
|
||||||
pytest_report.xml
|
pytest_report.xml
|
||||||
|
.coverage.picamera
|
||||||
|
.coverage.main
|
||||||
|
picamera_test_hashes.json
|
||||||
|
|
||||||
# Translations
|
# Translations
|
||||||
*.mo
|
*.mo
|
||||||
|
|
|
||||||
|
|
@ -130,15 +130,31 @@ pytest:
|
||||||
- git config --global user.name "Sir Unit of Test"
|
- git config --global user.name "Sir Unit of Test"
|
||||||
- git config --global user.email "fake@email.no"
|
- git config --global user.email "fake@email.no"
|
||||||
- pytest
|
- pytest
|
||||||
|
- mv .coverage .coverage.main
|
||||||
# --gitlab-code-quality-report=pytest-warnings.json # can restore when it installs ok
|
# --gitlab-code-quality-report=pytest-warnings.json # can restore when it installs ok
|
||||||
coverage: '/(?i)total.*? (100(?:\.0+)?\%|[1-9]?\d(?:\.\d+)?\%)$/'
|
|
||||||
artifacts:
|
artifacts:
|
||||||
when: always
|
when: always
|
||||||
paths:
|
paths:
|
||||||
- report.xml
|
- 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:
|
reports:
|
||||||
junit: report.xml
|
junit: report.xml
|
||||||
# codequality: pytest-warnings.json
|
|
||||||
coverage_report:
|
coverage_report:
|
||||||
coverage_format: cobertura
|
coverage_format: cobertura
|
||||||
path: coverage.xml
|
path: coverage.xml
|
||||||
|
|
|
||||||
|
|
@ -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.
|
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
|
/picamera2/test_exposure_time_drift.py::test_exposure_time_saves_and_loads -s --pdb
|
||||||
|
|
||||||
|
|
|
||||||
BIN
picamera_coverage.zip
Normal file
BIN
picamera_coverage.zip
Normal file
Binary file not shown.
|
|
@ -25,14 +25,14 @@ HASHED_FILES = [
|
||||||
|
|
||||||
|
|
||||||
def _get_hashes(include_coverage=False):
|
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
|
The key is the posixpath to the file so matching works even if the dictionary is
|
||||||
compared to a dictionary created on another system.
|
compared to a dictionary created on another system.
|
||||||
|
|
||||||
The coverage file is hashed when running for debug purposes.
|
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 = {}
|
hashes = {}
|
||||||
filepaths = HASHED_FILES
|
filepaths = HASHED_FILES
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue