freeleaps-service-hub/apps/notification/tests/README.md

32 lines
945 B
Markdown

## 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"
```