How to use _get_kind_options_from_executable_name method in avocado

Best Python code snippet using avocado_python

nrunner.py

Source:nrunner.py Github

copy

Full Screen

...584 status.update({"id": self.identifier})585 for status_service in self.status_services:586 status_service.post(status)587 yield status588def _get_kind_options_from_executable_name():589 executable_name = os.path.basename(sys.argv[0])590 match = re.match(r'^avocado\-runner\-(.+)$', executable_name)591 options = {'type': str, 'help': 'Kind of runnable'}592 if match:593 options['required'] = False594 options['default'] = match.group(1)595 options['help'] += ', defaults to "%(default)s"'596 else:597 options['required'] = True598 return options599class BaseRunnerApp:600 '''601 Helper base class for common runner application behavior602 '''603 #: The name of the command line application given to the command line604 #: parser605 PROG_NAME = ''606 #: The description of the command line application given to the607 #: command line parser608 PROG_DESCRIPTION = ''609 #: The types of runnables that this runner can handle. Dictionary key610 #: is a name, and value is a class that inherits from :class:`BaseRunner`611 RUNNABLE_KINDS_CAPABLE = {}612 #: The command line arguments to the "runnable-run" command613 CMD_RUNNABLE_RUN_ARGS = (614 (('-k', '--kind'),615 _get_kind_options_from_executable_name()),616 (('-u', '--uri'),617 {'type': str, 'default': None, 'help': 'URI of runnable'}),618 (('-c', '--config'),619 {'type': str, 'default': '{}', 'help': 'A config JSON data'}),620 (('-a', '--arg'),621 {'action': 'append', 'default': [],622 'help': 'Simple arguments to runnable'}),623 (('kwargs',),624 {'default': [], 'type': _parse_key_val, 'nargs': '*',625 'metavar': 'KEY_VAL',626 'help': 'Keyword (key=val) arguments to runnable'}),627 )628 CMD_RUNNABLE_RUN_RECIPE_ARGS = (629 (('recipe', ),...

Full Screen

Full Screen

app.py

Source:app.py Github

copy

Full Screen

...6import sys7import pkg_resources8from avocado.core.nrunner.runnable import Runnable9from avocado.core.nrunner.task import TASK_DEFAULT_CATEGORY, Task10def _get_kind_options_from_executable_name():11 executable_name = os.path.basename(sys.argv[0])12 match = re.match(r"^avocado\-runner\-(.+)$", executable_name)13 options = {"type": str, "help": "Kind of runnable"}14 if match:15 options["required"] = False16 options["default"] = match.group(1)17 options["help"] += ', defaults to "%(default)s"'18 else:19 options["required"] = True20 return options21def _parse_key_val(argument):22 key_value = argument.split("=", 1)23 if len(key_value) < 2:24 msg = (25 f'Invalid keyword parameter: "{argument}". Valid option must '26 f'be a "KEY=VALUE" like expression'27 )28 raise argparse.ArgumentTypeError(msg)29 return tuple(key_value)30class BaseRunnerApp:31 """32 Helper base class for common runner application behavior33 """34 #: The name of the command line application given to the command line35 #: parser36 PROG_NAME = ""37 #: The description of the command line application given to the38 #: command line parser39 PROG_DESCRIPTION = ""40 #: The names of types of runnables that this runner can handle.41 RUNNABLE_KINDS_CAPABLE = []42 #: The command line arguments to the "runnable-run" command43 CMD_RUNNABLE_RUN_ARGS = (44 (("-k", "--kind"), _get_kind_options_from_executable_name()),45 (("-u", "--uri"), {"type": str, "default": None, "help": "URI of runnable"}),46 (47 ("-c", "--config"),48 {"type": str, "default": "{}", "help": "A config JSON data"},49 ),50 (51 ("-a", "--arg"),52 {"action": "append", "default": [], "help": "Simple arguments to runnable"},53 ),54 (55 ("kwargs",),56 {57 "default": [],58 "type": _parse_key_val,...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run avocado automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful