docs(tests): add guide for generating coverage reports
This commit is contained in:
parent
b849e5f11b
commit
e46c81c993
32
apps/notification/tests/README.md
Normal file
32
apps/notification/tests/README.md
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
## unittest
|
||||||
|
```shell
|
||||||
|
# run the command
|
||||||
|
|
||||||
|
cd test/unit_test
|
||||||
|
python -m pytest unit_test_file.py -v --cov=backend.tested_directory --cov-report=html
|
||||||
|
```
|
||||||
|
After the test is completed, a htmlcov folder will be generated. The test result is in the htmlcov/index.html.
|
||||||
|
|
||||||
|
## integration test
|
||||||
|
```shell
|
||||||
|
# run the command
|
||||||
|
|
||||||
|
cd test/integration_test
|
||||||
|
python -m pytest integration_test_file.py -v -s --html=report.html --self-contained-html --asyncio-mode=auto
|
||||||
|
|
||||||
|
```
|
||||||
|
After the test is completed, a report.html will be generated. The test result is in the file.
|
||||||
|
```shell
|
||||||
|
python integration_test_file.py
|
||||||
|
python -m coverage html --include="../../backend/tested_directory/*"
|
||||||
|
```
|
||||||
|
After the test is completed, a htmlcov folder will be generated. The test result is in the htmlcov/index.html.
|
||||||
|
|
||||||
|
|
||||||
|
## Q & A
|
||||||
|
### Q: ModuleNotFoundError: No module named 'backend'
|
||||||
|
```shell
|
||||||
|
# export freeleaps code path
|
||||||
|
|
||||||
|
export PYTHONPATH="/yourpath/freeleaps-service-hub/apps/notification"
|
||||||
|
```
|
||||||
Loading…
Reference in New Issue
Block a user