I'm using pycov to generate the coverage report for a python tool that I've developed.
Workflow ♻:- Test Script -> Calls function from Helper File (Uses Subprocess to interact with Tool.py) -> Gets the stdout back and returns it to the test script.
⭐Coverage report needs to be generated for Tool.py
Even the the codeblocks are hit during the testing phase, they are being shown as not being covered in the coverage report generated in pycov.
This script runs all the test scripts.
for i in file_list:
if i.startswith("test_"):
test_files.append(i)
for file in test_files:
result_file_name = file.split(".")[0] + ".xml"
pytest.main([file, "-o", "junit_logging=system-out","--disable-pytest-warnings",
"--junitxml=" + result_folder + result_file_name, "--tb=line",
"--cov", "--cov-config=.coveragerc", "--cov-report=html", "--cov-report=", "--cov-append"])
In the .coveragerc file
[run]
branch = True
dynamic_context = test_function
include = Tool.py
Does anybody know a solution for this? Please do let me know, thanks!