How can I make sure my tests touch every line of my codebase?
--------------------------------------------------
Rise to the top 3% as a developer or hire one of them at Toptal: https://topt.al/25cXVn
--------------------------------------------------
Music by Eric Matyas
https://www.soundimage.org
Track title: Thinking It Over
--
Chapters
00:00 How Can I Make Sure My Tests Touch Every Line Of My Codebase?
00:41 Accepted Answer Score 4
01:21 Thank you
--
Full question
https://stackoverflow.com/questions/2592...
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#python #pytest
#avk47
Rise to the top 3% as a developer or hire one of them at Toptal: https://topt.al/25cXVn
--------------------------------------------------
Music by Eric Matyas
https://www.soundimage.org
Track title: Thinking It Over
--
Chapters
00:00 How Can I Make Sure My Tests Touch Every Line Of My Codebase?
00:41 Accepted Answer Score 4
01:21 Thank you
--
Full question
https://stackoverflow.com/questions/2592...
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#python #pytest
#avk47
ACCEPTED ANSWER
Score 4
Coverage might be the tool you're looking for:
Coverage.py measures code coverage, typically during test execution. It uses the code analysis tools and tracing hooks provided in the Python standard library to determine which lines are executable, and which have been executed.
Coverage measures the lines you're covering and also help you identify pending lines. For example, in coverage documentation you can see the kind of report it generates:
$ coverage report -m
Name Stmts Miss Cover Missing
-------------------------------------------------------
my_program 20 4 80% 33-35, 39
my_other_module 56 6 89% 17-23
-------------------------------------------------------
TOTAL 76 10 87%