-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
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 @@
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 @@
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: