Illusionist
Illusionist

Reputation: 5489

Debugger to print every line of code accessed in python

Is there an option in pdb or some other python debugging tool to print on screen/print to file every line of code that is being accessed ? I am going through some huge amounts of code so copying pasting by hand is tedious. I am wondering if someone could give me tips on how to do this in python or tell me if there are existing tools that do so.

Upvotes: 0

Views: 54

Answers (1)

Joe
Joe

Reputation: 47609

Looks like you want a code coverage tool. Try coverage, which will tell you which lines have been executed.

Taking a look at the example in the documentation, it can display which lines were executed: http://nedbatchelder.com/code/coverage/sample_html/cogapp_test_cogapp.html

Take a look at the 'reporting' and 'annotating' areas of the docs for info on how to get the most suitable output for your purposes.

Upvotes: 3

Related Questions