Best Python code snippet using avocado_python
loader.py
Source:loader.py  
...82            )83    def load_plugins(self, config):84        if self._initialized_plugins:85            return86        def _good_test_types(plugin):87            """88            List all supported test types (excluding incorrect ones)89            """90            name = plugin.name91            mapping = plugin.get_type_label_mapping()92            # Using __func__ to avoid problem with different term_supp instances93            healthy_func = getattr(output.TERM_SUPPORT.healthy_str, "__func__")94            types = [95                mapping[_[0]]96                for _ in plugin.get_decorator_mapping().items()97                if _[1].__func__ is healthy_func98            ]99            return [name + "." + _ for _ in types]100        def _str_loaders():101            """102            :return: string of sorted loaders and types103            """104            out = ""105            for plugin in self.registered_plugins:106                out += f"  {plugin.name}: " f"{', '.join(_good_test_types(plugin))}\n"107            return out.rstrip("\n")108        # When running from the JobAPI there is no subcommand109        subcommand = config.get("subcommand") or "run"110        # Add (default) file loader if not already registered111        if FileLoader not in self.registered_plugins:112            self.register_plugin(FileLoader)113        supported_loaders = [_.name for _ in self.registered_plugins]114        supported_types = []115        for plugin in self.registered_plugins:116            supported_types.extend(_good_test_types(plugin))117        # Here is one of the few exceptions that has a hardcoded default118        loaders = config.get(f"{subcommand}.loaders") or ["file", "@DEFAULT"]119        if "@DEFAULT" in loaders:  # Replace @DEFAULT with unused loaders120            idx = loaders.index("@DEFAULT")121            loaders = (122                loaders[:idx]123                + [plugin for plugin in supported_loaders if plugin not in loaders]124                + loaders[idx + 1 :]125            )126            # Remove duplicate @DEFAULT entries127            loaders = [item for item in loaders if item != "@DEFAULT"]128        loaders = [_.split(":", 1) for _ in loaders]129        priority = [_[0] for _ in loaders]130        for i, name in enumerate(priority):...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!!
