diff --git a/.gitignore b/.gitignore index 61616f78..87b75569 100644 --- a/.gitignore +++ b/.gitignore @@ -5,7 +5,7 @@ src/seedsigner.egg-info/ .vscode src/seedsigner/models/settings_definition.json .idea -.coverage +.coverage* seedsigner-screenshots *.po diff --git a/pyproject.toml b/pyproject.toml index 536700e2..01f60cfc 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -55,6 +55,7 @@ skip_empty = true [tool.coverage.run] branch = true +parallel = true [tool.pytest.ini_options] testpaths = ["tests"] diff --git a/tests/README.md b/tests/README.md index 12f321d3..686c7b86 100644 --- a/tests/README.md +++ b/tests/README.md @@ -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 ``` diff --git a/tests/screenshot_generator/README.md b/tests/screenshot_generator/README.md index 092a13b9..123c8e52 100644 --- a/tests/screenshot_generator/README.md +++ b/tests/screenshot_generator/README.md @@ -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