Best Python code snippet using avocado_python
parser.py
Source:parser.py  
...138        self.filename = filename139        self.config = None140        self.hints = []141        self._parse()142    def _get_args_from_section(self, section):143        try:144            args = self.config.get(section, 'args')145            if args == '$testpath':146                return [args]147            return args.split(',')148        except NoOptionError:149            return []150    def _get_kwargs_from_section(self, section):151        result = {}152        kwargs = self.config.get(section, 'kwargs', fallback='')153        for kwarg in kwargs.split(','):154            if kwarg == '':155                continue156            key, value = kwarg.split('=')157            result[key] = value158        return result159    def _get_resolutions_by_kind(self, kind, paths):160        self.validate_kind_section(kind)161        resolutions = []162        success = ReferenceResolutionResult.SUCCESS163        config = {'uri': self._get_uri_from_section(kind),164                  'args': self._get_args_from_section(kind),165                  'kwargs': self._get_kwargs_from_section(kind)}166        for path in paths:167            uri = config.get('uri')168            args = config.get('args')169            kwargs = config.get('kwargs')170            if uri == '$testpath':171                uri = path172            if '$testpath' in args:173                args = [item.replace('$testpath', path) for item in args]174            if '$testpath' in kwargs.values():175                kwargs = {k: v.replace('$testpath', path)176                          for k, v in kwargs.items()}177            runnable = Runnable(kind, uri, *args, **kwargs)178            resolutions.append(ReferenceResolution(reference=path,...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!!
