mirror of
https://github.com/SeedSigner/seedsigner.git
synced 2026-10-05 23:18:25 +00:00
63 lines
1.2 KiB
Markdown
63 lines
1.2 KiB
Markdown
# Running Tests
|
|
|
|
The tests are designed to be run on non-Raspi hardware.
|
|
|
|
On your testing machine you'll have to install:
|
|
```bash
|
|
# general dependencies
|
|
pip3 install -r requirements.txt
|
|
|
|
# test suite dependencies
|
|
pip3 install -r tests/requirements.txt
|
|
```
|
|
|
|
Then make the `seedsigner` python module visible/importable to the tests by installing it:
|
|
```
|
|
pip3 install -e .
|
|
```
|
|
|
|
Run the whole test suite:
|
|
```
|
|
pytest
|
|
```
|
|
|
|
Run a specific test file:
|
|
```
|
|
pytest tests/test_this_file.py
|
|
```
|
|
|
|
Run a specific test:
|
|
```
|
|
pytest tests/test_this_file.py::test_this_specific_test
|
|
```
|
|
|
|
Force pytest to show logging output:
|
|
```bash
|
|
pytest tests/test_this_file.py::test_this_specific_test -o log_cli=1
|
|
|
|
# or (same result)
|
|
|
|
pytest tests/test_this_file.py::test_this_specific_test --log-cli-level=DEBUG
|
|
```
|
|
|
|
Annoying complications:
|
|
* If you want to see `print()` statements that are in a test file, add `-s`
|
|
* Better idea: use a proper logger in the test file and use one of the above options to display logs
|
|
|
|
|
|
### Test Coverage
|
|
Run tests and generate test coverage
|
|
```
|
|
coverage run -m pytest
|
|
```
|
|
|
|
Show the resulting test coverage details:
|
|
```
|
|
coverage report
|
|
```
|
|
|
|
Generate the html overview:
|
|
```
|
|
coverage html
|
|
```
|