A modest suggestion for unittest.py

Peter Hansen peter at engcorp.com
Sat Aug 18 00:40:32 EDT 2001


Rich Harkins wrote:
> 
> Would it be okay with everyone if there was some option added to the
> TestProgram (invoked by default when using unittest.main()) so that it does
> not perform a sys.exit() when it is done running tests?  This would make it
> easier to run some tests and then drop through to the interpreter with -i.

I'm not sure this would work, but couldn't you do something like this 
somewhere in the code before the tests are executed?

>>> import sys
>>> def do_not_exit():
...   print 'sys.exit() caught and ignored.'
...
>>> sys.exit = do_not_exit

-- 
----------------------
Peter Hansen, P.Eng.
peter at engcorp.com



More information about the Python-list mailing list