How to use the getgauge.logger.error function in getgauge

To help you get started, we’ve selected a few getgauge examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github getgauge / gauge-python / getgauge / parser_parso.py View on Github external
def _step_decorator_args(self, decorator):
        """
        Get the arguments passed to step decorators
        converted to python objects.
        """
        args = decorator.children[3:-2]
        step = None
        if len(args) == 1:
            try:
                step = ast.literal_eval(args[0].get_code())
            except (ValueError, SyntaxError):
                pass
            if isinstance(step, six.string_types+(list,)):
                return step
            logger.error("Decorator step accepts either a string or a list of strings - {1}:{0}".format(self.file_path, decorator.start_pos[0]))
        else:
            logger.error("Decorator step accepts only one argument - {0}:{1}".format(self.file_path, decorator.start_pos[0]))
github getgauge / gauge-python / getgauge / parser_redbaron.py View on Github external
def _step_decorator_args(self, decorator):
        """
        Get arguments passed to step decorators converted to python objects.
        """
        args = decorator.call.value
        step = None
        if len(args) == 1:
            try:
                step = args[0].value.to_python()
            except (ValueError, SyntaxError):
                pass
            if isinstance(step, six.string_types + (list,)):
                return step
            logger.error("Decorator step accepts either a string or a list of \
                strings - %s".format(self.file_path))
        else:
            logger.error("Decorator step accepts only one argument - %s".format(self.file_path))
github getgauge / gauge-python / getgauge / impl_loader.py View on Github external
def _import_file(base_dir, file_path):
    rel_path = os.path.normpath(file_path.replace(base_dir + os.path.sep, ''))
    try:
        module_name = os.path.splitext(rel_path.replace(os.path.sep, '.'))[0]
        m = importlib.import_module(module_name)
        # Get all classes in the imported module
        classes = inspect.getmembers(m, lambda member: inspect.isclass(member) and member.__module__ == module_name)
        if len(classes) > 0:
            for c in classes:
                file = inspect.getfile(c[1])
                # Create instance of step implementation class.
                if _has_methods_with_gauge_decoratores(c[1]):
                    update_step_resgistry_with_class(c[1](), file_path) # c[1]() will create a new instance of the class
    except:
        logger.error('Exception occurred while loading step implementations from file: {}.'.format(rel_path))
        logger.error(traceback.format_exc())
github getgauge / gauge-python / getgauge / parser_redbaron.py View on Github external
"""
        Get arguments passed to step decorators converted to python objects.
        """
        args = decorator.call.value
        step = None
        if len(args) == 1:
            try:
                step = args[0].value.to_python()
            except (ValueError, SyntaxError):
                pass
            if isinstance(step, six.string_types + (list,)):
                return step
            logger.error("Decorator step accepts either a string or a list of \
                strings - %s".format(self.file_path))
        else:
            logger.error("Decorator step accepts only one argument - %s".format(self.file_path))