How to use get_runner_from_runnable method in avocado

Best Python code snippet using avocado_python

nrunner.py

Source:nrunner.py Github

copy

Full Screen

...708 :rtype: dict709 """710 return {"runnables": list(self.RUNNABLE_KINDS_CAPABLE.keys()),711 "commands": self.get_commands()}712 def get_runner_from_runnable(self, runnable):713 """714 Returns a runner that is suitable to run the given runnable715 :rtype: instance of class inheriting from :class:`BaseRunner`716 :raises: ValueError if runnable is now supported717 """718 runner = self.RUNNABLE_KINDS_CAPABLE.get(runnable.kind, None)719 if runner is not None:720 return runner(runnable)721 raise ValueError('Unsupported kind of runnable: %s' % runnable.kind)722 def command_capabilities(self, _):723 """724 Outputs capabilities, including runnables and commands725 The output is intended to be consumed by upper layers of Avocado, such726 as the Job layer selecting the right runner script to handle a runnable727 of a given kind, or identifying if a runner script has a given feature728 (as implemented by a command).729 """730 self.echo(json.dumps(self.get_capabilities()))731 def command_runnable_run(self, args):732 """733 Runs a runnable definition from arguments734 This defines a Runnable instance purely from the command line735 arguments, then selects a suitable Runner, and runs it.736 :param args: parsed command line arguments turned into a dictionary737 :type args: dict738 """739 runnable = Runnable.from_args(args)740 runner = self.get_runner_from_runnable(runnable)741 for status in runner.run():742 self.echo(status)743 def command_runnable_run_recipe(self, args):744 """745 Runs a runnable definition from a recipe746 :param args: parsed command line arguments turned into a dictionary747 :type args: dict748 """749 runnable = Runnable.from_recipe(args.get('recipe'))750 runner = self.get_runner_from_runnable(runnable)751 for status in runner.run():752 self.echo(status)753 def command_task_run(self, args):754 """755 Runs a task from arguments756 :param args: parsed command line arguments turned into a dictionary757 :type args: dict758 """759 runnable = Runnable.from_args(args)760 task = Task(args.get('identifier'), runnable,761 args.get('status_uri', []),762 known_runners=self.RUNNABLE_KINDS_CAPABLE)763 for status in task.run():764 self.echo(status)...

Full Screen

Full Screen

app.py

Source:app.py Github

copy

Full Screen

...178 "runnables": self.RUNNABLE_KINDS_CAPABLE,179 "commands": self.get_commands(),180 "configuration_used": self.get_configuration_used_by_runners(),181 }182 def get_runner_from_runnable(self, runnable):183 """184 Returns a runner that is suitable to run the given runnable185 :rtype: instance of class inheriting from :class:`BaseRunner`186 :raises: ValueError if runnable is now supported187 """188 runner = runnable.pick_runner_class()189 if runner is not None:190 return runner()191 raise ValueError(f"Unsupported kind of runnable: {runnable.kind}")192 def get_configuration_used_by_runners(self):193 """Returns the configuration keys used by capable runners.194 :returns: the configuration keys (aka namespaces) used by known runners195 :rtype: list196 """197 config_used = []198 for kind in self.RUNNABLE_KINDS_CAPABLE:199 for ep in pkg_resources.iter_entry_points(200 "avocado.plugins.runnable.runner", kind201 ):202 try:203 runner = ep.load()204 config_used += runner.CONFIGURATION_USED205 except ImportError:206 continue207 return list(set(config_used))208 def command_capabilities(self, _):209 """210 Outputs capabilities, including runnables and commands211 The output is intended to be consumed by upper layers of Avocado, such212 as the Job layer selecting the right runner script to handle a runnable213 of a given kind, or identifying if a runner script has a given feature214 (as implemented by a command).215 """216 self.echo(json.dumps(self.get_capabilities()))217 def command_runnable_run(self, args):218 """219 Runs a runnable definition from arguments220 This defines a Runnable instance purely from the command line221 arguments, then selects a suitable Runner, and runs it.222 :param args: parsed command line arguments turned into a dictionary223 :type args: dict224 """225 runnable = Runnable.from_args(args)226 runner = self.get_runner_from_runnable(runnable)227 for status in runner.run(runnable):228 self.echo(status)229 def command_runnable_run_recipe(self, args):230 """231 Runs a runnable definition from a recipe232 :param args: parsed command line arguments turned into a dictionary233 :type args: dict234 """235 runnable = Runnable.from_recipe(args.get("recipe"))236 runner = self.get_runner_from_runnable(runnable)237 for status in runner.run(runnable):238 self.echo(status)239 def command_task_run(self, args):240 """241 Runs a task from arguments242 :param args: parsed command line arguments turned into a dictionary243 :type args: dict244 """245 runnable = Runnable.from_args(args)246 task = Task(247 runnable,248 args.get("identifier"),249 args.get("status_uri", []),250 category=args.get("category", TASK_DEFAULT_CATEGORY),...

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