qubes/tests/run: --break-to-repl

This commit is contained in:
Wojtek Porczyk 2017-08-28 14:31:43 +02:00
parent 25670fbd61
commit f1334e5095

View File

@ -20,6 +20,7 @@
# #
import argparse import argparse
import code
import curses import curses
import itertools import itertools
import logging import logging
@ -337,6 +338,10 @@ parser.add_argument('--allow-running-along-qubesd',
help='allow running in parallel with qubesd;' help='allow running in parallel with qubesd;'
' this is DANGEROUS and WILL RESULT IN INCONSISTENT SYSTEM STATE') ' this is DANGEROUS and WILL RESULT IN INCONSISTENT SYSTEM STATE')
parser.add_argument('--break-to-repl',
action='store_true', default=False,
help='break to REPL after tests')
parser.add_argument('names', metavar='TESTNAME', parser.add_argument('names', metavar='TESTNAME',
action='store', nargs='*', action='store', nargs='*',
help='list of tests to run named like in description ' help='list of tests to run named like in description '
@ -362,8 +367,8 @@ def list_test_cases(suite):
yield test yield test
def main(): def main(args=None):
args = parser.parse_args() args = parser.parse_args(args)
suite = unittest.TestSuite() suite = unittest.TestSuite()
loader = unittest.TestLoader() loader = unittest.TestLoader()
@ -424,7 +429,12 @@ def main():
runner.resultclass = QubesDNCTestResult \ runner.resultclass = QubesDNCTestResult \
if args.do_not_clean else QubesTestResult if args.do_not_clean else QubesTestResult
return runner.run(suite).wasSuccessful() result = runner.run(suite)
if args.break_to_repl:
code.interact(local=locals())
return result.wasSuccessful()
if __name__ == '__main__': if __name__ == '__main__':