unitests don't run under pdb

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Sat Mar 15 05:11:20 EDT 2008


En Fri, 14 Mar 2008 17:23:14 -0200, Amit Gupta <emailamit at gmail.com>  
escribi�:
> On Feb 20, 8:51 pm, Miki <miki.teb... at gmail.com> wrote:
>> Hello Amit,
>>
>> > python testname.py : the unitests runs as usual and I get the
>> > following results:
>> > ----------------------------------------------------------------------
>> > Ran 2 tests in 0.024s
>>
>> > OK
>> > --------------------------------------------------------------------
>>
>> > However, if I do "python -mpdbtestnames.py": I get
>> > ython -mpdbtestnames.py> /s/nd6/amit/pyiglu/testnames.py(1)<module>()
>>
>> > -> importunittest
>> > (Pdb) c
>>
>> > ----------------------------------------------------------------------
>> > Ran 0 tests in 0.000s
>>
>
> So What do I do, if my testcase if failing because of an uncaught
> exception and I want to run it in pdb.

Run your script with python -i testname.py
If an exception occur, you'll get the Python prompt. Execute:
py> import pdb
py> pdb.pm()
to enter pdb "post-mortem".

-- 
Gabriel Genellina




More information about the Python-list mailing list