I have a python3 application running with flask
and I am using Tavern
and pytest
for test cases. The test cases are executed as expected and it shows results correctly. But I always get 0% code coverage.
This is the command line for running tests:
python3 -m pytest --cov=api --cov-report html:reports/Coverage --cov-report term --junitxml=reports/UnitTest.xm
l --html=reports/TestSummary.html --self-contained-html
All the source code are under api
module. And the coverage results only shows 100%
for the file __init__.py
in each module. It doesn't show any coverage data for the real source code.
The dependencies versions for the tests in this project is:
flask==1.1.1
flask_testing==0.7.1
coverage>=4.0.3
nose>=1.3.7
pluggy>=0.3.1
py>=1.4.31
randomize>=0.13
pytest==4.6.4
pytest-cov>=2.6.0
tavern==0.26.4
pytest-html>=1.20.0
pytest-freezegun>=0.3.0
pytest-mock>=1.10.3
The content of .coveragerc
in my project is:
[report]
exclude_lines =
if __name__ == .__main__.: