Skip to content

d-campagne/client_python

 
 

Repository files navigation

Report for Assignment 1 resit

Project chosen

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

Coverage measurement with existing tool

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

Screenshot 2024-07-10 041002

Coverage improvement

Individual tests

Function 1: _bake_output()

https://github.com/prometheus/client_python/commit/629f4b3f368c984f4567045dfa7520e39ccca6bc

Old coverage:

Screenshot 2024-07-08 180642

New coverage:

Screenshot 2024-07-10 021559

Improved coverage:

Screenshot 2024-07-10 022422

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:

Screenshot 2024-07-08 181208

New coverage:

Screenshot 2024-07-10 021718

Screenshot 2024-07-10 022457

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

Overall

Old coverage:

Screenshot 2024-07-10 041002

New coverage:

Screenshot 2024-07-10 041015

About

Prometheus instrumentation library for Python applications

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%