[Assorted-commits] SF.net SVN: assorted:[900] python-commons/trunk/src/commons/startup.py
Brought to you by:
yangzhang
From: <yan...@us...> - 2008-07-18 08:38:53
|
Revision: 900 http://assorted.svn.sourceforge.net/assorted/?rev=900&view=rev Author: yangzhang Date: 2008-07-18 08:39:01 +0000 (Fri, 18 Jul 2008) Log Message: ----------- tweaked exception handling for szdb Modified Paths: -------------- python-commons/trunk/src/commons/startup.py Modified: python-commons/trunk/src/commons/startup.py =================================================================== --- python-commons/trunk/src/commons/startup.py 2008-07-18 08:38:42 UTC (rev 899) +++ python-commons/trunk/src/commons/startup.py 2008-07-18 08:39:01 UTC (rev 900) @@ -12,7 +12,7 @@ from os.path import basename from sys import _current_frames from threading import currentThread -import os, sys +import os, sys, unittest class UnsetError( Exception ): pass @@ -146,6 +146,8 @@ except KeyError: pass else: + if os.environ.get( 'PYTEST', '' ) != '': + unittest.main() if do_force or runner is not None or name == '__main__': runner = ( ( lambda main, args: main( args ) ) if runner is None else runner ) @@ -173,9 +175,9 @@ status = container[0] else: status = runner( main, sys.argv ) - except BaseException, ex: - if handle_exceptions: - print >> sys.stderr, ex.message + except ( KeyboardInterrupt, Exception ), ex: + if handle_exceptions and not isinstance( ex, AssertionError ): + print >> sys.stderr, ex sys.exit(1) else: raise This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |