Added pause/resume feature
KeyboardInterrupt now pauses the runner. From there, the user can Ctrl-C again or type "quit" to stop execution, or press ENTER to continue. Change-Id: Ib0384bbd06c248ba0f5dd61cfa16c8c3aaea975e
This commit is contained in:
parent
7729461698
commit
55ef06d45e
|
@ -20,6 +20,7 @@ import unittest
|
|||
|
||||
from oslo_config import cfg
|
||||
import six
|
||||
from six.moves import input
|
||||
|
||||
import syntribos.config
|
||||
from syntribos.formatters.json_formatter import JSONFormatter
|
||||
|
@ -207,6 +208,7 @@ class Runner(object):
|
|||
templates_path = remotes.get(CONF.remote.templates_uri)
|
||||
templates_dir = ContentType("r", 0)(templates_path)
|
||||
|
||||
print("\nPress Ctrl-C to pause or exit...\n")
|
||||
for file_path, req_str in templates_dir:
|
||||
LOG = cls.get_logger(file_path)
|
||||
CONF.log_opt_values(LOG, logging.DEBUG)
|
||||
|
@ -368,10 +370,20 @@ class Runner(object):
|
|||
result.testsRunSinceLastPrint = result.testsRun
|
||||
|
||||
except KeyboardInterrupt:
|
||||
result.print_result(cls.start_time)
|
||||
cleanup.delete_temps()
|
||||
print("Keyboard interrupt, exiting...")
|
||||
exit(0)
|
||||
print('\n\nPausing... Hit ENTER to continue, type quit to exit.')
|
||||
try:
|
||||
response = input()
|
||||
if response.lower() == "quit":
|
||||
result.print_result(cls.start_time)
|
||||
cleanup.delete_temps()
|
||||
print("Exiting...")
|
||||
exit(0)
|
||||
print('Resuming...')
|
||||
except KeyboardInterrupt:
|
||||
result.print_result(cls.start_time)
|
||||
cleanup.delete_temps()
|
||||
print("Exiting...")
|
||||
exit(0)
|
||||
|
||||
@classmethod
|
||||
def run_test(cls, test, result):
|
||||
|
|
Loading…
Reference in New Issue