def configure(self, parser): """ Add the subparser for the list action. :param parser: The Avocado command line application parser :type parser: :class:`avocado.core.parser.ArgumentParser` """ parser = super().configure(parser) settings.add_argparser_to_option(namespace='resolver.references', nargs='*', metavar='TEST_REFERENCE', parser=parser, positional_arg=True, long_arg=None, allow_multiple=True) help_msg = ('Writes runnable recipe files to a directory.') settings.register_option(section='list.recipes', key='write_to_directory', default=None, metavar='DIRECTORY', help_msg=help_msg, parser=parser, long_arg='--write-recipes-to-directory') help_msg = 'Writes output to a json file.' settings.register_option(section='list', key='write_to_json_file', default=None, metavar='JSON_FILE', help_msg=help_msg, parser=parser, long_arg='--json') parser_common_args.add_tag_filter_args(parser)
def configure(self, parser): """ Add the subparser for the assets action. :param parser: The Avocado command line application parser :type parser: :class:`avocado.core.parser.ArgumentParser` """ parser = super(Assets, self).configure(parser) subcommands = parser.add_subparsers(dest='assets_subcommand') subcommands.required = True fetch_subcommand_parser = subcommands.add_parser( 'fetch', help='Fetch assets from test source or config file if it\'s not' ' already in the cache') help_msg = "Path to avocado instrumented test" settings.register_option(section='assets.fetch', key='references', help_msg=help_msg, default=[], metavar='AVOCADO_INSTRUMENTED', key_type=list, nargs='+', parser=fetch_subcommand_parser, positional_arg=True) help_msg = "always return success for the fetch command." settings.register_option(section='assets.fetch', key='ignore_errors', help_msg=help_msg, default=False, key_type=bool, parser=fetch_subcommand_parser, long_arg='--ignore-errors')
def configure(self, parser): run_subcommand_parser = parser.subcommands.choices.get('run', None) if run_subcommand_parser is None: return msg = 'result-upload options' parser = run_subcommand_parser.add_argument_group(msg) help_msg = 'Specify the result upload url' settings.register_option(section='plugins.result_upload', key='url', default=None, help_msg=help_msg, parser=parser, long_arg='--result-upload-url', metavar='URL') try: rsync_bin = utils_path.find_command('rsync') def_ssh = ('ssh -oLogLevel=error -o stricthostkeychecking=no' ' -o userknownhostsfile=/dev/null' ' -o batchmode=yes -o passwordauthentication=no') def_upload_cmd = f'{rsync_bin} -arz -e \'{def_ssh} \'' except utils_path.CmdNotFoundError: def_upload_cmd = None help_msg = 'Specify the command to upload results' settings.register_option(section='plugins.result_upload', key='cmd', help_msg=help_msg, default=def_upload_cmd, parser=parser, long_arg='--result-upload-cmd', metavar='COMMAND')
def configure(self, parser): for name in ("run", "variants"): subparser = parser.subcommands.choices.get(name, None) if subparser is None: continue subparser.add_argument_group("CIT varianter options") settings.register_option( section=f"{name}.cit", key="parameter_file", metavar="PATH", help_msg="Paths to a parameter file", parser=subparser, default=None, long_arg="--cit-parameter-file", ) help_msg = "Order of combinations. Maximum number is 6" settings.register_option( section=f"{name}.cit", key="combination_order", key_type=int, parser=subparser, help_msg=help_msg, metavar="ORDER", default=DEFAULT_ORDER_OF_COMBINATIONS, long_arg="--cit-order-of-combinations", )
def configure(self, parser): subparser = parser.subcommands.choices.get('run', None) if subparser is None: return mux_options = subparser.add_argument_group( "yaml to mux testsuite options") help_msg = "Filter only part of the YAML suite file" settings.register_option(section='run', key='mux_suite_only', nargs='+', help_msg=help_msg, parser=mux_options, long_arg='--mux-suite-only', key_type=list, default=[]) help_msg = "Filter out part of the YAML suite file" settings.register_option(section='run', key='mux_suite_out', nargs='+', help_msg=help_msg, parser=mux_options, long_arg='--mux-suite-out', key_type=list, default=[])
def configure(self, parser): """ Add the subparser for the run action. :param parser: Main test runner parser. """ run_subcommand_parser = parser.subcommands.choices.get('run', None) list_subcommand_parser = parser.subcommands.choices.get('list', None) msg = 'test execution using restriction-generated graph of setup state dependencies' if run_subcommand_parser: cmd_parser = run_subcommand_parser.add_argument_group(msg) settings.register_option(section='run', key='auto', key_type=bool, default=False, help_msg="Run in auto mode.", parser=cmd_parser, long_arg='--auto') if list_subcommand_parser: cmd_parser = list_subcommand_parser.add_argument_group(msg) settings.register_option(section='list', key='auto', key_type=bool, default=False, help_msg="Run in auto mode.", parser=cmd_parser, long_arg='--auto')
def initialize(self): help_msg = 'Load the Variants from Python dictionaries' settings.register_option(section='run', key='dict_variants', default=[], key_type=list, help_msg=help_msg)
def initialize(self): section = 'spawner.podman' help_msg = 'Path to the podman binary' settings.register_option( section=section, key='bin', help_msg=help_msg, default='/usr/bin/podman') this_distro = distro.detect() if this_distro != distro.UNKNOWN_DISTRO: default_distro = '{0}:{1}'.format(this_distro.name, this_distro.version) else: default_distro = 'fedora:latest' help_msg = ('Image name to use when creating the container. ' 'The first default choice is a container image ' 'matching the current OS. If unable to detect, ' 'default becomes the latest Fedora release. Default ' 'on this system: {0}'.format(default_distro)) settings.register_option( section=section, key='image', help_msg=help_msg, default=default_distro)
def configure(self, parser): settings.register_option( section="hello", key="message", key_type=str, default=self.description, help_msg="Configure the message to display", )
def initialize(self): help_msg = ("Status that will be omitted from the Human UI. " "Valid statuses: %s" % ", ".join(COMPLETE_STATUSES)) settings.register_option(section='human_ui.omit', key='statuses', key_type=list, default=[], help_msg=help_msg)
def initialize(self): help_msg = ("Status that will trigger the output of a test's logs " "after the job ends. " "Valid statuses: %s" % ", ".join(user_facing_status)) settings.register_option(section='job.output.testlogs', key='statuses', key_type=list, default=[], help_msg=help_msg)
def initialize(self): help_msg = ('Defines the order of iterating through test suite ' 'and test variants') settings.register_option(section='run', key='execution_order', choices=('tests-per-variant', 'variants-per-test'), default='variants-per-test', help_msg=help_msg)
def initialize(self): help_msg = "Defines the order of iterating through test suite and test variants" settings.register_option( section="run", key="execution_order", choices=("tests-per-variant", "variants-per-test"), default="variants-per-test", help_msg=help_msg, )
def initialize(self): help_msg = (f"Status that will be omitted from the Human UI. " f"Valid statuses: {', '.join(COMPLETE_STATUSES)}") settings.register_option( section="human_ui.omit", key="statuses", key_type=list, default=[], help_msg=help_msg, )
def configure(self, parser): parser = super(HelloWorld, self).configure(parser) settings.register_option(section='hello', key='message', key_type=str, default=self.description, help_msg="Configure the message to display", parser=parser, long_arg='--hello-message')
def configure(self, parser): parser = super().configure(parser) settings.register_option( section="hello", key="message", key_type=str, default=self.description, help_msg="Configure the message to display", parser=parser, long_arg="--hello-message", )
def configure(self, parser): parser = super().configure(parser) help_msg = 'Will list the plugins in execution order' settings.register_option(section='plugins', key='ordered_list', default=False, key_type=bool, action='store_true', help_msg=help_msg, parser=parser, long_arg='--ordered', short_arg='-o')
def configure(self, parser): parser = super().configure(parser) help_msg = ('Replays a job, identified by: complete or partial Job ' 'ID, "latest" for the latest job, the job results path.') settings.register_option(section='job.replay', key='source_job_id', help_msg=help_msg, metavar='SOURCE_JOB_ID', default='latest', nargs='?', positional_arg=True, parser=parser)
def configure(self, parser): parser = super().configure(parser) help_msg = ("Replays a job, identified by: complete or partial Job " 'ID, "latest" for the latest job, the job results path.') settings.register_option( section="job.replay", key="source_job_id", help_msg=help_msg, metavar="SOURCE_JOB_ID", default="latest", nargs="?", positional_arg=True, parser=parser, )
def initialize(self): help_msg = 'Warn if configured (or default) directory does not exist' settings.register_option(section='plugins.jobscripts', key='warn_non_existing_dir', key_type=bool, default=False, help_msg=help_msg) help_msg = 'Warn if any script run return non-zero status' settings.register_option(section='plugins.jobscripts', key='warn_non_zero_status', key_type=bool, default=True, help_msg=help_msg) help_msg = 'Directory with scripts to be executed before a job is run' default = '/etc/avocado/scripts/job/pre.d/' settings.register_option(section='plugins.jobscripts', key='pre', key_type=prepend_base_path, help_msg=help_msg, default=default) help_msg = 'Directory with scripts to be executed after a job is run' default = '/etc/avocado/scripts/job/post.d/' settings.register_option(section='plugins.jobscripts', key='post', key_type=prepend_base_path, help_msg=help_msg, default=default)
def configure(self, parser): parser = super().configure(parser) help_msg = "Will list the plugins in execution order" settings.register_option( section="plugins", key="ordered_list", default=False, key_type=bool, action="store_true", help_msg=help_msg, parser=parser, long_arg="--ordered", short_arg="-o", )
def initialize(self): help_msg = ('Enable JSON result format and write it to FILE. ' 'Use "-" to redirect to the standard output.') settings.register_option(section='job.run.result.json', key='output', default=None, help_msg=help_msg) help_msg = ('Enables default JSON result in the job results ' 'directory. File will be named "results.json".') settings.register_option(section='job.run.result.json', key='enabled', default='on', help_msg=help_msg)
def configure(self, parser): run_subcommand_parser = parser.subcommands.choices.get('run', None) if run_subcommand_parser is None: return help_msg = 'Archive (ZIP) files generated by tests' settings.register_option(section='run.results', key='archive', default=False, help_msg=help_msg, key_type=bool, parser=run_subcommand_parser, short_arg='-z', long_arg='--archive')
def initialize(self): section = 'job.run.result.xunit' help_msg = ('Enable xUnit result format and write it to FILE. ' 'Use "-" to redirect to the standard output.') settings.register_option(section=section, key='output', help_msg=help_msg, default=None) help_msg = ('Enables default xUnit result in the job results ' 'directory. File will be named "results.xml".') settings.register_option(section=section, key='enabled', key_type=bool, default=True, help_msg=help_msg) help_msg = ('Override the reported job name. By default uses the ' 'Avocado job name which is always unique. This is useful ' 'for reporting in Jenkins as it only evaluates ' 'first-failure from jobs of the same name.') settings.register_option(section=section, key='job_name', default=None, help_msg=help_msg) help_msg = ('Limit the attached job log to given number of characters ' '(k/m/g suffix allowed)') settings.register_option(section=section, key='max_test_log_chars', help_msg=help_msg, key_type=lambda x: DataSize(x).b, default=DataSize('100000').b)
def initialize(self): help_msg = "Mail recipient." settings.register_option( section="plugins.job.mail", key="recipient", default="*****@*****.**", help_msg=help_msg, ) help_msg = "Mail header." settings.register_option( section="plugins.job.mail", key="header", default="[AVOCADO JOB NOTIFICATION]", help_msg=help_msg, ) help_msg = "Mail sender." settings.register_option( section="plugins.job.mail", key="sender", default="*****@*****.**", help_msg=help_msg, ) help_msg = "Mail server." settings.register_option( section="plugins.job.mail", key="server", default="localhost", help_msg=help_msg, )
def initialize(self): section = 'nrunner' help_msg = 'Shuffle the tasks to be executed' settings.register_option(section=section, key='shuffle', default=False, help_msg=help_msg, key_type=bool) help_msg = 'URI for the status server, usually a "HOST:PORT" string' settings.register_option(section=section, key='status_server_uri', default='127.0.0.1:8888', metavar="HOST:PORT", help_msg=help_msg) help_msg = ('Number of maximum number tasks running in parallel. You ' 'can disable parallel execution by setting this to 1. ' 'Defaults to the amount of CPUs on this machine.') settings.register_option(section=section, key='max_parallel_tasks', default=multiprocessing.cpu_count(), key_type=int, help_msg=help_msg) help_msg = ("Spawn tasks in a specific spawner. Available spawners: " "'process' and 'podman'") settings.register_option(section=section, key="spawner", default='process', help_msg=help_msg)
def configure(self, parser): run_subcommand_parser = parser.subcommands.choices.get('run', None) if run_subcommand_parser is None: return help_msg = ('Records test status changes (for use with ' 'avocado-journal-replay and avocado-server)') settings.register_option(section='run.journal', key='enabled', default=False, key_type=bool, help_msg=help_msg, parser=run_subcommand_parser, long_arg='--journal')
def initialize(self): help_msg = 'Load the Variants from Python dictionaries' settings.register_option(section='run', key='dict_variants', default=[], key_type=list, help_msg=help_msg) help_msg = ('Configure the key that will be used to name the ' 'variant ID. If not set, will use all keys.') settings.register_option(section='run.dict_variants', key='variant_id_keys', default=[], key_type=list, help_msg=help_msg)
def add_loader_options(parser, section='run'): arggrp = parser.add_argument_group('loader options') help_msg = ("Overrides the priority of the test loaders. You can specify " "either @loader_name or TEST_TYPE. By default it tries all " "available loaders according to priority set in " "settings->plugins.loaders.") settings.register_option(section=section, key='loaders', nargs='+', key_type=list, default=['file', '@DEFAULT'], help_msg=help_msg, parser=arggrp, long_arg='--loaders', metavar='LOADER_NAME_OR_TEST_TYPE')
def __init__(self): self.args = argparse.Namespace() self.config = {} self.subcommands = None self.application = ArgumentParser( prog=PROG, add_help=False, description=DESCRIPTION # see parent parsing ) self.application.add_argument("-v", "--version", action="version", version=f"Avocado {VERSION}") self.application.add_argument( "--config", metavar="CONFIG_FILE", nargs="?", help="Use custom configuration from a file", ) help_msg = "Turn the paginator on. Useful when output is too long." settings.register_option( section="core", key="paginator", help_msg=help_msg, key_type=bool, default=False, action="store_true", parser=self.application, long_arg="--enable-paginator", ) help_msg = ("Some commands can produce more information. This option " "will enable the verbosity when applicable.") settings.register_option( section="core", key="verbose", help_msg=help_msg, default=False, key_type=bool, parser=self.application, long_arg="--verbose", short_arg="-V", ) settings.add_argparser_to_option(namespace="core.show", parser=self.application, long_arg="--show")