Dear Experts,

How do you use pdb to debug when a TestCase object from the unittest module
fails? Basically, I'd like to run my unit tests and invoke pdb.pm when
something fails.

I tried the following with now success:

Imagine that I have a module _test.py that looks like the following:

-----------------------
import unittest
class MyTest(unittest.TestCase):
   def testIt(self):
       raise Exception('boom')
if __name__ == '__main__':
   unittest.main()
-----------------------

If I do

import _test; _test.unittest()

no tests get run.

If I try

import _test; t = _test.MyTest()

I get

Traceback (most recent call last):
 File "<stdin>", line 1, in <module>
 File "c:\python25\lib\unittest.py", line 209, in __init__
   (self.__class__, methodName)
ValueError: no such test method in <class '_test.MyTest'>: runTest

If I try

import _test; t = _test.MyTest(methodName='testIt'); t.run()

nothing happens.

Thanks,
-Emin
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to