I have multiple python modules to be tested and I’m testing it using the tox file with the command “coverage run -m test_folder”.
While testing, for few modules I’m getting lower test coverage. All the testcases have been written in the test file and it’s working fine But when I checked coverage.html file, it is showing that function body is not executed but while debugging, the code is entering the function body.
for example:
Below is the function body for function fun_xyz.
def fun_xyz(input): *-> Coverage.html shows that only this line has run*
function_body *-> Coverage.html shows that function body has not run but while debugging test case, function body is executing*
............
return output
Below is the testcase for the above function.
test_file.py
def test_xyz(input):
output = fun_xyz(input) *-> while debugging, the code is entering into function body and executing successfully*
assert output == expected_output
I also added “#pragma = no cover” for some of the lines which are not included in the testcase. I’m trying to increase test coverage but overall percentage is not increasing because of the above mentioned issue.
May I please know how to resolve this issue?
3