Best Python code snippet using avocado_python
loader.py
Source:loader.py
...83 types = [mapping[_[0]]84 for _ in plugin.get_decorator_mapping().iteritems()85 if _[1].__func__ is healthy_func]86 return [name + '.' + _ for _ in types]87 def _str_loaders():88 """89 :return: string of sorted loaders and types90 """91 return ", ".join(sorted(supported_types + supported_loaders))92 self._initialized_plugins = []93 # Add (default) file loader if not already registered94 # if FileLoader not in self.registered_plugins:95 # self.register_plugin(FileLoader)96 if ExternalLoader not in self.registered_plugins:97 self.register_plugin(ExternalLoader)98 # Register external runner when --external-runner is used99 if getattr(args, "external_runner", None):100 self.register_plugin(ExternalLoader)101 args.loaders = ["external:%s" % args.external_runner]102 supported_loaders = [_.name for _ in self.registered_plugins]103 supported_types = []104 for plugin in self.registered_plugins:105 supported_types.extend(_good_test_types(plugin))106 # Load plugin by the priority from settings107 loaders = getattr(args, 'loaders', None)108 if not loaders:109 loaders = settings.get_value("plugins", "loaders", list, [])110 if '?' in loaders:111 raise LoaderError("Available loader plugins: %s" % _str_loaders())112 if "@DEFAULT" in loaders: # Replace @DEFAULT with unused loaders113 idx = loaders.index("@DEFAULT")114 loaders = (loaders[:idx] + [plugin for plugin in supported_loaders115 if plugin not in loaders] +116 loaders[idx + 1:])117 while "@DEFAULT" in loaders: # Remove duplicate @DEFAULT entries118 loaders.remove("@DEFAULT")119 loaders = [_.split(':', 1) for _ in loaders]120 priority = [_[0] for _ in loaders]121 for i, name in enumerate(priority):122 extra_params = {}123 if name in supported_types:124 name, extra_params['allowed_test_types'] = name.split('.', 1)125 elif name not in supported_loaders:126 raise InvalidLoaderPlugin("Loader '%s' not available (%s)"127 % (name, _str_loaders()))128 if len(loaders[i]) == 2:129 extra_params['loader_options'] = loaders[i][1]130 plugin = self.registered_plugins[supported_loaders.index(name)]131 self._initialized_plugins.append(plugin(args, extra_params))132 def get_extra_listing(self):133 for loader_plugin in self._initialized_plugins:134 loader_plugin.get_extra_listing()135 def get_base_keywords(self):136 base_path = []137 for loader_plugin in self._initialized_plugins:138 base_path += loader_plugin.get_base_keywords()139 return base_path140 def get_type_label_mapping(self):141 mapping = {}...
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.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!