Skip to content

Commit 63e4ef3

Browse files
authored
Add a failfast command-line option to runner.py (#15111)
This is functionality already exposed by `TextTestRunner`.
1 parent f9ea674 commit 63e4ef3

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

tests/runner.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ def run_tests(options, suites):
272272
print('Test suites:')
273273
print([s[0] for s in suites])
274274
# Run the discovered tests
275-
testRunner = unittest.TextTestRunner(verbosity=2)
275+
testRunner = unittest.TextTestRunner(verbosity=2, failfast=options.failfast)
276276
for mod_name, suite in suites:
277277
print('Running %s: (%s tests)' % (mod_name, suite.countTestCases()))
278278
res = testRunner.run(suite)
@@ -310,6 +310,8 @@ def parse_args(args):
310310
parser.add_argument('--browser',
311311
help='Command to launch web browser in which to run browser tests.')
312312
parser.add_argument('tests', nargs='*')
313+
parser.add_argument('--failfast', dest='failfast', action='store_const',
314+
const=True, default=False)
313315
return parser.parse_args()
314316

315317

0 commit comments

Comments
 (0)