How to use pick_runner_class_from_entry_point method in avocado

Best Python code snippet using avocado_python

nrunner.py

Source:nrunner.py Github

copy

Full Screen

...221 return candidate_cmd222 # exhausted probes, let's save the negative on the cache and avoid223 # future similar problems224 runners_registry[self.kind] = False225 def pick_runner_class_from_entry_point(self):226 """Selects a runner class from entry points based on kind.227 This is related to the :data:`SpawnMethod.PYTHON_CLASS`. This228 complements the :data:`RUNNERS_REGISTRY_PYTHON_CLASS` on systems229 that have setuptools available.230 :returns: a class that inherits from :class:`BaseRunner` or None231 """232 if not PKG_RESOURCES_AVAILABLE:233 return234 namespace = 'avocado.plugins.runnable.runner'235 for ep in pkg_resources.iter_entry_points(namespace):236 if ep.name == self.kind:237 try:238 obj = ep.load()239 return obj240 except ImportError:241 return242 def pick_runner_class(self, runners_registry=None):243 """Selects a runner class from the registry based on kind.244 This is related to the :data:`SpawnMethod.PYTHON_CLASS`245 :param runners_registry: a registry with previously registered246 runner classes, keyed by runnable kind247 :param runners_registry: dict248 :returns: a class that inherits from :class:`BaseRunner`249 :raises: ValueError if kind there's no runner from kind of runnable250 """251 if runners_registry is None:252 runners_registry = RUNNERS_REGISTRY_PYTHON_CLASS253 runner = runners_registry.get(self.kind, None)254 if runner is None:255 runner = self.pick_runner_class_from_entry_point()256 if runner is not None:257 return runner258 raise ValueError('Unsupported kind of runnable: %s' % self.kind)259class BaseRunner:260 """261 Base interface for a Runner262 """263 def __init__(self, runnable):264 self.runnable = runnable265 def prepare_status(self, status_type, additional_info=None):266 """Prepare a status dict with some basic information.267 This will add the keyword 'status' and 'time' to all status.268 :param: status_type: The type of event ('started', 'running',269 'finished')...

Full Screen

Full Screen

runnable.py

Source:runnable.py Github

copy

Full Screen

...404 :returns: command line arguments to execute the runner405 :rtype: list of str or None406 """407 return Runnable.pick_runner_command(self.kind, runners_registry)408 def pick_runner_class_from_entry_point(self):409 """Selects a runner class from entry points based on kind.410 This is related to the :data:`SpawnMethod.PYTHON_CLASS`.411 :returns: a class that inherits from :class:`BaseRunner` or None412 """413 namespace = "avocado.plugins.runnable.runner"414 for ep in pkg_resources.iter_entry_points(namespace, self.kind):415 try:416 obj = ep.load()417 return obj418 except ImportError:419 return420 def pick_runner_class(self):421 """Selects a runner class from the registry based on kind.422 This is related to the :data:`SpawnMethod.PYTHON_CLASS`423 :param runners_registry: a registry with previously registered424 runner classes, keyed by runnable kind425 :param runners_registry: dict426 :returns: a class that inherits from :class:`BaseRunner`427 :raises: ValueError if kind there's no runner from kind of runnable428 """429 runner = self.pick_runner_class_from_entry_point()430 if runner is not None:431 return runner...

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