Improve README a for hardware specific tests, and make fixes to picamera_tests script
This commit is contained in:
parent
212374a6f9
commit
e7d5b8bd1f
3 changed files with 27 additions and 3 deletions
|
|
@ -12,7 +12,7 @@ However, this will not archive the tests in the Git repository for reporting the
|
|||
|
||||
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
|
||||
pytest hardware-specific-tests/picamera2/test_exposure_time_drift.py::test_exposure_time_saves_and_loads -s --pdb
|
||||
|
||||
### Reporting the coverage
|
||||
|
||||
|
|
@ -20,4 +20,28 @@ To create a coverage report that will be included into the repository run:
|
|||
|
||||
./picamera_tests.py run
|
||||
|
||||
This will create a zip of test results along with hashes of the picamera files and the base camera file. The server will include this overage report if the source files remain the same.
|
||||
This will create a zip of test results along with hashes of the picamera files and the base camera file. The server will include this coverage report if the source files remain the same.
|
||||
|
||||
### Creating a combined report locally
|
||||
|
||||
To create a combined coverage report locally (similar to the one created on CI) first run all normal tests with `pytest`.
|
||||
|
||||
Copy the `.coverage` file to `.coverage.main`
|
||||
|
||||
cp .coverage .coverage.main
|
||||
|
||||
Then run:
|
||||
|
||||
./picamera_tests.py unzip
|
||||
|
||||
to get the `.coverage.picamera` file.
|
||||
|
||||
To combine reports run:
|
||||
|
||||
coverage combine
|
||||
|
||||
It is then possible to run:
|
||||
|
||||
* `coverage report` to get the in-terminal report of the coverage.
|
||||
* `coverage html` to get the HTML overview of covered lines.
|
||||
* `coverage xml` to get an XML report any software that may need it.
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -38,7 +38,7 @@ def _get_hashes(include_coverage: bool = False) -> dict[str, str]:
|
|||
filepaths = HASHED_FILES
|
||||
if include_coverage:
|
||||
filepaths.append(COVERAGE_FILE)
|
||||
for filepath in HASHED_FILES:
|
||||
for filepath in filepaths:
|
||||
if not os.path.isfile(filepath):
|
||||
# Sys exit rather than raise for better command line experience
|
||||
print(f"ERROR: {filepath} does not exist!")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue