Name: Client_python
URL: https://github.com/prometheus/client_python
Number of lines of code and the tool used to count it:
Lines: 7428
Tool used: lizard
Programming language: Python
To meassure the original coverage of the code I used coverage which I ran with the command:
coverage run -m pytest, while I was already in the tests directory
Function 1: _bake_output()
https://github.com/prometheus/client_python/commit/629f4b3f368c984f4567045dfa7520e39ccca6bc
Old coverage:
New coverage:
Improved coverage:
The old coverage was 3/4, because only 3 branches were hit of the 4 branches, if we also take into consideration that there are hidden else branches for each if branch. I improved this coverage to 100% especially by adding tests for the first if statement, but also not forgetting to create tests for the second if statement and hidden else statements, in order for every branch to be hit
Function 2: write_to_textfile()
https://github.com/prometheus/client_python/commit/629f4b3f368c984f4567045dfa7520e39ccca6bc
Old coverage:
New coverage:
The old coverage was 0%, because none of the branches were hit. I improved the coverage to 100% by adding tests that hit every branch
Old coverage:
New coverage: