예제 #1
0
 def _get_message(self, record):
     try:
         return record.getMessage(), None
     except:
         message = 'Failed to log following message properly: %s' \
                     % utils.unic(record.msg)
         error = '\n'.join(utils.get_error_details())
         return message, error
예제 #2
0
 def _report_adding_keyword_failed(self, name, message=None, details=None,
                                   level=None):
     if not message:
         message, details = get_error_details()
     LOGGER.write("Adding keyword '%s' to library '%s' failed: %s"
                  % (name, self.name, message), level or self._failure_level)
     if details:
         LOGGER.debug('Details:\n%s' % details)
예제 #3
0
파일: testlibraries.py 프로젝트: Garjy/RIDE
 def _report_adding_keyword_failed(self, name, message=None, details=None,
                                   level=None):
     if not message:
         message, details = get_error_details()
     LOGGER.write("Adding keyword '%s' to library '%s' failed: %s"
                  % (name, self.name, message), level or self._failure_level)
     if details:
         LOGGER.debug('Details:\n%s' % details)
예제 #4
0
 def call_method(self, method, *args):
     try:
         method(*args)
     except:
         message, details = get_error_details()
         LOGGER.error("Calling listener method '%s' of listener '%s' "
                      "failed: %s" % (method.__name__, self.name, message))
         LOGGER.info("Details:\n%s" % details)
예제 #5
0
파일: listeners.py 프로젝트: Garjy/RIDE
 def call_method(self, method, *args):
     try:
         method(*args)
     except:
         message, details = get_error_details()
         LOGGER.error("Calling listener method '%s' of listener '%s' "
                      "failed: %s" % (method.__name__, self.name, message))
         LOGGER.info("Details:\n%s" % details)
예제 #6
0
 def _get_message(self, record):
     try:
         return record.getMessage(), None
     except:
         message = 'Failed to log following message properly: %s' \
                     % unic(record.msg)
         error = '\n'.join(get_error_details())
         return message, error
예제 #7
0
 def _raise_creating_instance_failed(self):
     msg, details = get_error_details()
     if self.positional_args or self.named_args:
         args = self.positional_args \
             + ['%s=%s' % item for item in self.named_args]
         args_text = 'arguments %s' % seq2str2(args)
     else:
         args_text = 'no arguments'
     raise DataError("Initializing test library '%s' with %s failed: %s\n%s"
                     % (self.name, args_text, msg, details))
예제 #8
0
파일: testlibraries.py 프로젝트: Garjy/RIDE
 def _raise_creating_instance_failed(self):
     msg, details = get_error_details()
     if self.positional_args or self.named_args:
         args = self.positional_args \
             + ['%s=%s' % item for item in self.named_args.items()]
         args_text = 'arguments %s' % seq2str2(args)
     else:
         args_text = 'no arguments'
     raise DataError("Initializing test library '%s' with %s failed: %s\n%s"
                     % (self.name, args_text, msg, details))
예제 #9
0
파일: modifier.py 프로젝트: Garjy/RIDE
 def visit_suite(self, suite):
     for visitor in self._visitors:
         try:
             suite.visit(visitor)
         except:
             message, details = get_error_details()
             self._log_error("Executing model modifier '%s' failed: %s\n%s"
                             % (type_name(visitor), message, details))
     if not (suite.test_count or self._empty_suite_ok):
         raise DataError("Suite '%s' contains no tests after model "
                         "modifiers." % suite.name)
예제 #10
0
 def _close_listener(self, listener):
     method = (getattr(listener, 'close', None) or
               getattr(listener, '_close', None))
     try:
         if method:
             method()
     except:
         message, details = get_error_details()
         name = getattr(listener, '__name__', None) or type_name(listener)
         LOGGER.error("Calling method '%s' of listener '%s' failed: %s"
                      % (method.__name__, name, message))
         LOGGER.info("Details:\n%s" % details)
예제 #11
0
 def visit_suite(self, suite):
     for visitor in self._visitors:
         try:
             suite.visit(visitor)
         except:
             message, details = get_error_details()
             self._log_error(
                 "Executing model modifier '%s' failed: %s\n%s" %
                 (type_name(visitor), message, details))
     if not (suite.test_count or self._empty_suite_ok):
         raise DataError("Suite '%s' contains no tests after model "
                         "modifiers." % suite.name)
예제 #12
0
 def _set_cli_variables(self, settings):
     for path, args in settings.variable_files:
         try:
             path = find_file(path, file_type='Variable file')
             self.set_from_file(path, args)
         except:
             msg, details = get_error_details()
             LOGGER.error(msg)
             LOGGER.info(details)
     for varstr in settings.variables:
         try:
             name, value = varstr.split(':', 1)
         except ValueError:
             name, value = varstr, ''
         self['${%s}' % name] = value
예제 #13
0
파일: scopes.py 프로젝트: Garjy/RIDE
 def _set_cli_variables(self, settings):
     for path, args in settings.variable_files:
         try:
             path = find_file(path, file_type='Variable file')
             self.set_from_file(path, args)
         except:
             msg, details = get_error_details()
             LOGGER.error(msg)
             LOGGER.info(details)
     for varstr in settings.variables:
         try:
             name, value = varstr.split(':', 1)
         except ValueError:
             name, value = varstr, ''
         self['${%s}' % name] = value
예제 #14
0
 def __call__(self, args):
     if self.called:
         return
     try:
         ListenerMethod.called = True
         self.method(*args)
     except TimeoutError:
         # Propagate possible timeouts:
         # https://github.com/robotframework/robotframework/issues/2763
         raise
     except:
         message, details = get_error_details()
         LOGGER.error("Calling method '%s' of listener '%s' failed: %s" %
                      (self.method.__name__, self.listener_name, message))
         LOGGER.info("Details:\n%s" % details)
     finally:
         ListenerMethod.called = False
예제 #15
0
 def __call__(self, args):
     if self.called:
         return
     try:
         ListenerMethod.called = True
         self.method(*args)
     except TimeoutError:
         # Propagate possible timeouts:
         # https://github.com/robotframework/robotframework/issues/2763
         raise
     except:
         message, details = get_error_details()
         LOGGER.error("Calling method '%s' of listener '%s' failed: %s"
                      % (self.method.__name__, self.listener_name, message))
         LOGGER.info("Details:\n%s" % details)
     finally:
         ListenerMethod.called = False
예제 #16
0
 def _create_handlers(self, libcode):
     try:
         names = self._get_handler_names(libcode)
     except:
         message, details = get_error_details()
         raise DataError("Getting keyword names from library '%s' failed: %s"
                         % (self.name, message), details)
     for name in names:
         method = self._try_to_get_handler_method(libcode, name)
         if method:
             handler, embedded = self._try_to_create_handler(name, method)
             if handler:
                 try:
                     self.handlers.add(handler, embedded)
                 except DataError as err:
                     LOGGER.error("Error in test library '%s': "
                                  "Creating keyword '%s' failed: %s"
                                  % (self.name, handler.name, err.message))
                 else:
                     LOGGER.debug("Created keyword '%s'" % handler.name)