diff options
author | Adrien Di Mascio <Adrien.DiMascio@logilab.fr> | 2007-03-07 12:14:21 +0100 |
---|---|---|
committer | Adrien Di Mascio <Adrien.DiMascio@logilab.fr> | 2007-03-07 12:14:21 +0100 |
commit | 6873165724bb3522da25c1d6d57faba43e99cfd0 (patch) | |
tree | 51fa38bd4eaa084e1633fdba0d3a321c0229345a | |
parent | 1c4c0edb15cf5776ccfb0af3f99ea584e42c2271 (diff) | |
download | logilab-common-6873165724bb3522da25c1d6d57faba43e99cfd0.tar.gz |
added a batch mode on unittest_main
-rw-r--r-- | testlib.py | 11 |
1 files changed, 7 insertions, 4 deletions
@@ -511,7 +511,8 @@ Examples: %(progName)s MyTestCase - run all 'test*' test methods in MyTestCase """ - def __init__(self, module='__main__'): + def __init__(self, module='__main__', batchmode=False): + self.batchmode = batchmode super(SkipAwareTestProgram, self).__init__( module=module, testLoader=NonStrictTestLoader()) @@ -560,7 +561,9 @@ Examples: self.pdbmode = True if result.debuggers and self.pdbmode: start_interactive_mode(result.debuggers, result.descrs) - sys.exit(not result.wasSuccessful()) + if not self.batchmode: + sys.exit(not result.wasSuccessful()) + self.result = result @@ -638,10 +641,10 @@ def capture_stderr(): return _capture('stderr') -def unittest_main(module='__main__'): +def unittest_main(module='__main__', batchmode=False): """use this functon if you want to have the same functionality as unittest.main""" - SkipAwareTestProgram(module) + return SkipAwareTestProgram(module, batchmode) class TestSkipped(Exception): """raised when a test is skipped""" |