<div>Thanks for the reply, but neither of those work for me. I don't seem to have the "trial" program installed. Where do you get it?</div>
<div> </div>
<div>Also, when I use the try/catch block, I get the following error:</div>
<div> </div>
<div>Traceback (most recent call last):<br>  File "_test.py", line 10, in <module><br>    pdb.pm()<br>  File "c:\python25\lib\pdb.py", line 1148, in pm<br>    post_mortem(sys.last_traceback)<br>
AttributeError: 'module' object has no attribute 'last_traceback'<br><br> </div>
<div><span class="gmail_quote">On 7/18/07, <b class="gmail_sendername">Jean-Paul Calderone</b> <<a href="mailto:exarkun@divmod.com">exarkun@divmod.com</a>> wrote:</span>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">On Wed, 18 Jul 2007 16:40:46 -0400, "Emin.shopper Martinian.shopper" <<a href="mailto:emin.shopper@gmail.com">
emin.shopper@gmail.com</a>> wrote:<br>>Dear Experts,<br>><br>>How do you use pdb to debug when a TestCase object from the unittest module<br>>fails? Basically, I'd like to run my unit tests and invoke <a href="http://pdb.pm">
pdb.pm</a> when<br>>something fails.<br>><br>>I tried the following with now success:<br>><br>>Imagine that I have a module _test.py that looks like the following:<br>><br>>-----------------------<br>
>import unittest<br>>class MyTest(unittest.TestCase):<br>>    def testIt(self):<br>>        raise Exception('boom')<br>>if __name__ == '__main__':<br>>    unittest.main()<br>>-----------------------
<br>><br>>If I do<br>>>>>import _test; _test.unittest()<br>><br>>no tests get run.<br>><br>>If I try<br>>>>>import _test; t = _test.MyTest()<br>><br>>I get<br>><br>>Traceback (most recent call last):
<br>>  File "<stdin>", line 1, in <module><br>>  File "c:\python25\lib\unittest.py", line 209, in __init__<br>>    (self.__class__, methodName)<br>>ValueError: no such test method in <class '_test.MyTest'>: runTest
<br>><br>>If I try<br>>>>>import _test; t = _test.MyTest(methodName='testIt'); t.run()<br>><br>>nothing happens.<br><br>I use `trial -b <filename>', which automatically enables a bunch of nice
<br>debugging functionality. ;)  However, you can try this, if you're not<br>interested in using a highly featureful test runner:<br><br>   try:<br>       unittest.main()<br>   except:<br>       import pdb<br>       pdb.pm
()<br><br>This will "post-mortem" the exception, a commonly useful debugging<br>technique.<br><br>Jean-Paul<br>--<br><a href="http://mail.python.org/mailman/listinfo/python-list">http://mail.python.org/mailman/listinfo/python-list
</a><br></blockquote></div><br>