psoriasis
unread,May 24, 2013, 1:49:09 AM5/24/13Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Winpdb
So, I have a file with a class def and I want to test it. My thought
was that, like in the interpreter, I could define the classes by
running the file and then, after perhaps setting a breakpoint in the
classes __init__, use the console to execute a statement that created
an instance of the class (which then would put me at my breakpoint).
see "*" at the end
However, if I "run" it just executes the whole file and it doesn't
seem to establish the class definition (as it would if I was in an
interpreter). I say this because if after I run I go to the console
and exec the create of an instance of the class it doesn't seem to
know what I'm talking about.
I gather that I could alter the file so that the last line in the file
creates the instance and so when I run the file (in winpbd of course)
it would hit that line and I could test but I'd much rather be able to
do stuff like that on the fly vs having to alter the file I'm testing
not to mention that, from what I can tell, I would need to alter the
file elsewhere as winpdb's source window is read-only
*
let's say the file had the class def below (as the entire contents of
the file I've loaded into winpdb) and I want to test the "__init__"
function. Let's say I set a breakpoint at 'print "hi mom"
What would I do in winpdb to get to the breakpoint at the 'print "hi
mom" ' statement (which I imagine means creating an instance of cFred
which requires a statement not in the file)
class cFred:
def __init__(self):
print "hi mom"