[IPython-user] unittest'ing in iPython

danny shevitz danny_shevitz at yahoo.com
Fri Apr 22 12:14:48 CDT 2005


Howdy,

I'm an IPython newbie, although an experienced python user. I tried
searching the archives, but this is too frustrating being archived by
month. Is there a fully searchable archive? BTW I'm running on Win2K,
python 2.3.4, ipython 0.6.13.

Here's the question: I use unittest'ing extensively. I want to unittest
under IPython. If there is an exception I want to drop into the
debugger at the point of that exception. The problem is that the
unittesting framework catches all exceptions and deals with them
nicely. Is there any way to enter the debugger if something fails in my
unit tests? I have been trying the %run command, but to no avail. 

A second question is again with unittest'ing. When I run in a dos
prompt I get:

*********************************************************************
E:\working copies\frag\tests>nodeTest.py
......
id: [14148944]
        parent: None
        left: None
        right: None
        isLeaf: True
.
----------------------------------------------------------------------
Ran 7 tests in 0.000s

OK
*********************************************************************

when I run in IPython I get:

*********************************************************************
In [15]: run nodeTest
......
id: [23531632]
        parent: None
        left: None
        right: None
        isLeaf: True
.
----------------------------------------------------------------------
Ran 7 tests in 0.000s

OK
---------------------------------------------------------------------------
exceptions.SystemExit                                Traceback (most
recent call
 last)

E:\working copies\frag\tests\nodeTest.py
     53 #if __name__ == '__main__':
     54
---> 55 unittest.main()
     56
     57

D:\ENTHOU~1\lib\unittest.py in __init__(self, module, defaultTest,
argv, testRun
ner, testLoader)
    719         self.progName = os.path.basename(argv[0])
    720         self.parseArgs(argv)
--> 721         self.runTests()
    722
    723     def usageExit(self, msg=None):

D:\ENTHOU~1\lib\unittest.py in runTests(self)
    757             self.testRunner =
TextTestRunner(verbosity=self.verbosity)
    758         result = self.testRunner.run(self.test)
--> 759         sys.exit(not result.wasSuccessful())
    760
    761 main = TestProgram

SystemExit: False
WARNING: Failure executing file: <nodeTest.py>
*********************************************************************


what's up with all the junk at the end? this is run with %pdb off

thanks,
Danny

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 




More information about the IPython-user mailing list