I am looking to automatically instrument all bytecode that is executed from my initial Python script.
For instance, I'll have a directory setup like this:
+ main.py
+ file1.py
+----dir1/dir1_file2.py
+----dir1/dir1_file3.py
I've been looking over the equip
package and it seems to fit my needs, however I am struggling to get all my bytecode files to be instrumented.
This example specifically seems to be what I need to do, but I am not certain the best way to get it to 'follow' the links.
For instance, if I have a class in dir1/dir1_file2.py
that is imported into my main.py
, how can I get that bytecode output instrumented? Do I need to essentially run a loop over all *.pyc
files recursively in my directory structure, or is there a way to get it to follow the actions of the program?
Edit: I am specifically looking to instrument the code so that I can calculate metrics such as branch coverage, minimal CFGs, and so on. This is going to lead towards some software testing.