Python tracing and conditional jumps
--------------------------------------------------
Hire the world's top talent on demand or became one of them at Toptal: https://topt.al/25cXVn
--------------------------------------------------
Music by Eric Matyas
https://www.soundimage.org
Track title: Riding Sky Waves v001
--
Chapters
00:00 Python Tracing And Conditional Jumps
02:12 Answer 1 Score 6
02:47 Thank you
--
Full question
https://stackoverflow.com/questions/6943...
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#python #testing #branch #trace
#avk47
    Hire the world's top talent on demand or became one of them at Toptal: https://topt.al/25cXVn
--------------------------------------------------
Music by Eric Matyas
https://www.soundimage.org
Track title: Riding Sky Waves v001
--
Chapters
00:00 Python Tracing And Conditional Jumps
02:12 Answer 1 Score 6
02:47 Thank you
--
Full question
https://stackoverflow.com/questions/6943...
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#python #testing #branch #trace
#avk47
ANSWER 1
Score 6
There is no information in the trace facility about the last branch taken.
What I did to implement branch coverage measurement in coverage.py is to keep a record for each stack frame of the last line executed, then the next time the trace function is called, I can record a pair of line numbers which form a from-to arc of execution.
About finer-grained tracing: you can trick the Python interpreter into giving you byte code information. My experiment in this is described here: Wicked hack: Python bytecode tracing
I'd be very interested to see how this work progresses!