Merge pytest results and screenshot generator coverage

This commit is contained in:
kdmukai
2024-11-05 13:19:46 -06:00
parent 7ee89c88b9
commit 28d21bbeca
4 changed files with 26 additions and 6 deletions
+1 -1
View File
@@ -5,7 +5,7 @@ src/seedsigner.egg-info/
.vscode
src/seedsigner/models/settings_definition.json
.idea
.coverage
.coverage*
seedsigner-screenshots
*.po
+1
View File
@@ -55,6 +55,7 @@ skip_empty = true
[tool.coverage.run]
branch = true
parallel = true
[tool.pytest.ini_options]
testpaths = ["tests"]
+22 -4
View File
@@ -45,18 +45,36 @@ Annoying complications:
* Better idea: use a proper logger in the test file and use one of the above options to display logs
### Test Coverage
## Screenshot generator
The screenshot generator is meant to mostly be a utility and not really part of the test suite. However,
it is actually implemented to be run by `pytest`.
see: [Screenshot generator README](screenshot_generator/README.md)
## Test Coverage
Run tests and generate test coverage
```
```bash
coverage run -m pytest
```
Show the resulting test coverage details:
The screenshots have to be run separately, but they can also add to overall coverage:
```bash
coverage run -m pytest tests/screenshot_generator/generator.py --locale es
```
Each run creates its own `.coverage.*` results file. Merge them into one result with:
```bash
coverage combine
```
Show the resulting test coverage details:
```bash
coverage report
```
Generate the html overview:
```
```bash
coverage html
```
+2 -1
View File
@@ -11,7 +11,8 @@ pytest tests/screenshot_generator/generator.py
You can also run a `coverage` report to see exactly what the screenshots are and are not hitting:
```bash
coverage run -m pytest tests/screenshot_generator/generator.py --locale es && coverage report
coverage erase
coverage run -m pytest tests/screenshot_generator/generator.py --locale es && coverage combine && coverage report
# Generate the interactive html report
coverage html