提交 fb1700e8 编写于 作者: L Lukáš Doktor

avocado.plugins: Few cleanups and style improvements

Signed-off-by: NLukáš Doktor <ldoktor@redhat.com>
上级 3423ca96
......@@ -29,7 +29,7 @@ class Multiplex(CLICmd):
"""
name = 'multiplex'
description = 'Generate a list of dictionaries with params from a multiplex file'
description = "Tool to analyze and visualize test variants and params"
def __init__(self, *args, **kwargs):
super(Multiplex, self).__init__(*args, **kwargs)
......
......@@ -37,7 +37,8 @@ class Run(CLICmd):
"""
name = 'run'
description = 'Run one or more tests (native test, test alias, binary or script)'
description = ("Runs one or more tests (native test, test alias, binary"
"or script)")
def configure(self, parser):
"""
......@@ -55,15 +56,16 @@ class Run(CLICmd):
help="Instead of running the test only "
"list them and log their params.")
parser.add_argument('-z', '--archive', action='store_true', default=False,
help='Archive (ZIP) files generated by tests')
parser.add_argument('-z', '--archive', action='store_true',
default=False, help='Archive (ZIP) files generated'
' by tests')
parser.add_argument('--force-job-id', dest='unique_job_id',
type=str, default=None,
help=('Forces the use of a particular job ID. Used '
'internally when interacting with an avocado '
'server. You should not use this option '
'unless you know exactly what you\'re doing'))
help='Forces the use of a particular job ID. Used '
'internally when interacting with an avocado '
'server. You should not use this option '
'unless you know exactly what you\'re doing')
parser.add_argument('--job-results-dir', action='store',
dest='logdir', default=None, metavar='DIRECTORY',
......@@ -72,37 +74,37 @@ class Run(CLICmd):
parser.add_argument('--job-timeout', action='store',
default=None, metavar='SECONDS',
help=('Set the maximum amount of time (in SECONDS) that '
'tests are allowed to execute. '
'Values <= zero means "no timeout". '
'You can also use suffixes, like: '
' s (seconds), m (minutes), h (hours). '))
help='Set the maximum amount of time (in SECONDS) '
'that tests are allowed to execute. '
'Values <= zero means "no timeout". '
'You can also use suffixes, like: '
' s (seconds), m (minutes), h (hours). ')
parser.add_argument('--failfast', choices=('on', 'off'),
help='Enable or disable the job interruption on '
'first failed test.')
'first failed test.')
sysinfo_default = settings.get_value('sysinfo.collect',
'enabled',
key_type='bool',
default=True)
sysinfo_default = 'on' if sysinfo_default is True else 'off'
parser.add_argument('--sysinfo', choices=('on', 'off'), default=sysinfo_default,
help=('Enable or disable system information '
'(hardware details, profilers, etc.). '
'Current: %(default)s'))
parser.add_argument('--sysinfo', choices=('on', 'off'),
default=sysinfo_default, help="Enable or disable "
"system information (hardware details, profilers, "
"etc.). Current: %(default)s")
parser.output = parser.add_argument_group('output and result format')
parser.output.add_argument(
'-s', '--silent', action="store_true", default=argparse.SUPPRESS,
help='Silence stdout')
parser.output.add_argument('-s', '--silent', action="store_true",
default=argparse.SUPPRESS,
help='Silence stdout')
parser.output.add_argument(
'--show-job-log', action='store_true', default=False,
help=('Display only the job log on stdout. Useful '
'for test debugging purposes. No output will '
'be displayed if you also specify --silent'))
parser.output.add_argument('--show-job-log', action='store_true',
default=False, help="Display only the job "
"log on stdout. Useful for test debugging "
"purposes. No output will be displayed if "
"you also specify --silent")
parser.output.add_argument("--store-logging-stream", nargs="*",
default=[], metavar="STREAM[:LEVEL]",
......@@ -114,21 +116,20 @@ class Run(CLICmd):
out_check.add_argument('--output-check-record',
choices=('none', 'all', 'stdout', 'stderr'),
default='none',
help=('Record output streams of your tests '
'to reference files (valid options: '
'none (do not record output streams), '
'all (record both stdout and stderr), '
'stdout (record only stderr), '
'stderr (record only stderr). '
'Current: %(default)s'))
help="Record output streams of your tests "
"to reference files (valid options: none (do "
"not record output streams), all (record both "
"stdout and stderr), stdout (record only "
"stderr), stderr (record only stderr). "
'Current: %(default)s')
out_check.add_argument('--output-check', choices=('on', 'off'),
default='on',
help=('Enable or disable test output (stdout/stderr) check. '
'If this option is off, no output will '
'be checked, even if there are reference files '
'present for the test. '
'Current: on (output check enabled)'))
help="Enable or disable test output (stdout/"
"stderr) check. If this option is off, no "
"output will be checked, even if there are "
"reference files present for the test. "
"Current: on (output check enabled)")
loader.add_loader_options(parser)
......@@ -173,9 +174,9 @@ class Run(CLICmd):
job_run = job_instance.run()
result_dispatcher = ResultDispatcher()
if result_dispatcher.extensions:
# At this point job_instance doesn't have a single results attribute
# which is the end goal. For now, we pick any of the plugin classes
# added to the result proxy.
# At this point job_instance doesn't have a single results
# attribute which is the end goal. For now, we pick any of the
# plugin classes added to the result proxy.
if len(job_instance.result_proxy.output_plugins) > 0:
result = job_instance.result_proxy.output_plugins[0]
result_dispatcher.map_method('render', result, job_instance)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册