tests: add -x / --exitfirst option to fail fast

This commit is contained in:
Daniel Hahler 2015-02-08 20:37:08 +01:00
parent 6602da89dd
commit 936aac8da6

View File

@ -104,6 +104,8 @@ if __name__ == '__main__':
help='How often should each test be retried before it is ' help='How often should each test be retried before it is '
'considered failed. Works around flakyness in the terminal ' 'considered failed. Works around flakyness in the terminal '
'multiplexer and race conditions in writing to the file system.') 'multiplexer and race conditions in writing to the file system.')
p.add_option("-x", "--exitfirst", dest="exitfirst", action="store_true",
help="exit instantly on first error or failed test.")
o, args = p.parse_args() o, args = p.parse_args()
if o.interface not in ('screen', 'tmux'): if o.interface not in ('screen', 'tmux'):
@ -163,7 +165,8 @@ if __name__ == '__main__':
return return
v = 2 if options.verbose else 1 v = 2 if options.verbose else 1
res = unittest.TextTestRunner(verbosity=v).run(suite) res = unittest.TextTestRunner(verbosity=v,
failfast=options.exitfirst).run(suite)
main() main()