diff options
author | Michael Foord <fuzzyman@voidspace.org.uk> | 2010-03-22 01:01:34 (GMT) |
---|---|---|
committer | Michael Foord <fuzzyman@voidspace.org.uk> | 2010-03-22 01:01:34 (GMT) |
commit | 1b9e95339de2f592b48c7640857956e28f2ce859 (patch) | |
tree | 27243ef2a4b12616522d31fc5f1ab6794fc008c1 /Lib/unittest/runner.py | |
parent | b1aa30f94ded4e9d1094ec890758d913b8725085 (diff) | |
download | cpython-1b9e95339de2f592b48c7640857956e28f2ce859.zip cpython-1b9e95339de2f592b48c7640857956e28f2ce859.tar.gz cpython-1b9e95339de2f592b48c7640857956e28f2ce859.tar.bz2 |
-f/--failfast command line option for unittest. Issue 8074. Documentation still needed. Plus minor change to test_unittest to allow it to be run with python -m test.unittest
Diffstat (limited to 'Lib/unittest/runner.py')
-rw-r--r-- | Lib/unittest/runner.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/Lib/unittest/runner.py b/Lib/unittest/runner.py index f9e1995..fd56a30 100644 --- a/Lib/unittest/runner.py +++ b/Lib/unittest/runner.py @@ -124,10 +124,11 @@ class TextTestRunner(object): resultclass = TextTestResult def __init__(self, stream=sys.stderr, descriptions=True, verbosity=1, - resultclass=None): + failfast=False, resultclass=None): self.stream = _WritelnDecorator(stream) self.descriptions = descriptions self.verbosity = verbosity + self.failfast = failfast if resultclass is not None: self.resultclass = resultclass @@ -137,6 +138,7 @@ class TextTestRunner(object): def run(self, test): "Run the given test case or test suite." result = self._makeResult() + result.failfast = self.failfast startTime = time.time() startTestRun = getattr(result, 'startTestRun', None) if startTestRun is not None: |