0

I have a test suite and trying to enhance it for better debug ability. I need to get the history of function call, return status and the line number at which the function returned. This is to be done without doing a change at each and every function but in one common location which calls the test routines. I tried using traceback, but it gives the state of current stack only. If I want to know history of the functions called, I would not get using traceback. Any pointers could really be useful Thank you all.

Example:

enter code here
def a():
  print "I am in A"
  ret = xyz()
  return ret

def b():
  ret = a()
  print "I am in B"
  return ret

def c():
  print "I am in C"
  return True

if __name__ == "__main__":
  val = b();
  if val == False:
     ==> Print History <==
3
  • 1
    What do you mean by history ? Please give an example of what you need. Commented Jul 25, 2013 at 8:22
  • Say I have following code snippet: def a(): print "I am in A" ret = xyz() return ret def b(): ret = a() print "I am in B" return ret def c(): print "I am in C" return True if name == "main": val = b(); if val == False: ==> Print History <== Commented Jul 25, 2013 at 8:39
  • 2
    You should edit your question. As such it's unreadable. Commented Jul 25, 2013 at 8:40

1 Answer 1

3

Try out the trace module. It will let you see what functions (and even what lines) of a program have been run.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.