freeleaps-service-hub/apps/notification/tests
2025-08-11 15:47:08 +08:00
..
unit_tests test: add unit tests for template_message and email_sender services 2025-07-28 11:03:01 +08:00
README.md docs(tests): add guide for generating coverage reports 2025-07-28 11:09:46 +08:00

unittest

# 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

# 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.

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'

# export freeleaps code path

export PYTHONPATH="/yourpath/freeleaps-service-hub/apps/notification"