i have a python flask project where i am using the below commands to run test cases and get coverage report
pytest tests/ --cov=. --cov-report xml:coverage.xml
coverage report -m
My flask api project folder looks like below
I have conftest.py which uses pytest.fixture() and a flask client for the flaskapi.
My conftest.py looks like below
@pytest.fixture() def client(): app = connexion.FlaskApp( __name__, specification_dir=os.path.join("swagger")) app.add_api('openapi.yaml', validate_responses=True, strict_validation=True) with app.app.test_client() as c: yield c
I have written multiple test cases which hits the api using the client created in the conftest class. Even though the api.py file calls other functions in file2.py, file3.py etc. In the coverage report , I can only see the api.py file with 100%. other files in the subfolders like folder_D are not showing up in the coverage report.
Any idea on why the other python files are missing in the sonarqube,