sys.exit and '-i'

Ulrich Eckhardt eckhardt at satorlaser.com
Thu Dec 4 08:30:42 EST 2008


Hi!

The unittest module will invoke sys.exit() after running the tests in order
to signal success or failure. However, I sometimes don't want to exit the
interpreter but instead e.g. inspect some state or just keep the window
open. Normally, using '-i' as commandline argument works, but not in the
case here.

My questions are:
1. Is that a bug? After all, an explicit request on the commandline was
ignored. Is it perhaps simply wrong how the unittest module handles
error/success signalling?
2. I can catch the SystemExit exception and ignore it, but that doesn't
actually help, because then I get a normal exit even in case of failures.
Of course, I could pass that value to sys.exit(), but then I'd be back at
the start.

Any suggestions?

Uli

-- 
Sator Laser GmbH
Geschäftsführer: Thorsten Föcking, Amtsgericht Hamburg HR B62 932




More information about the Python-list mailing list