def _dump_meta_info(): path = get_path_for_metadata() file = os.path.join(path, '%s.json' % get_filename_base()) try: report_to_file(file) except: log.exception('Error while dump test metadata to file')
def _collect_error_details(): _meta = current_test._meta_info _meta['stack_trace'] = format_exc() _meta['message'] = str(sys.exc_info()[1]) if config.utils.get('collect_page_source', True): try: _collect_page_source() except: log.exception('Error collecting page source')
def _dump_meta_info(): if not current_test.has_errors(): return path = get_path_for_metadata() file = os.path.join(path, '%s.json' % get_filename_base()) try: report_to_file(file) except: log.exception('Error while dump test metadata to file')
def run_multiple_times(self): for i in range(1, self.run_count + 1): log.info('Benchmark \'{}\' iter {}'.format(self._testMethodName, i)) try: self._set_up_iter() res = self._single_method() self._tear_down_iter() except: log.exception('Benchmark \'{}\' iter {} exception:'.format(self._testMethodName, i)) raise return res
def run_multiple_times(self): for i in range(1, self.run_count + 1): log.info('Benchmark \'{}\' iter {}'.format(self._testMethodName, i)) try: self._set_up_iter() res = self._single_method() self._tear_down_iter() except: log.exception('Benchmark \'{}\' iter {} exception:'.format( self._testMethodName, i)) raise return res
def _collect_error_details(): _meta = current_test._meta_info _meta['stack_trace'] = format_exc() _meta['message'] = str(sys.exc_info()[1]) if config.utils.get('collect_page_source', True): try: _collect_page_source() except: log.exception('Error collecting page source') if hasattr(current_test, 'logcat'): try: current_test.logcat.collect() except: log.exception('Error collecting logcat')
def _create_session(cls): """ :rtype: Driver """ attepmts = int(config.session.get('session_start_attempts', 3)) attempt_pause = config.session.get('session_start_pause', 0.1) last_exception = None for attempt in range(attepmts): try: cls._connect_to_proxy() return cls._start_driver(cls.desired_capabilities, cls.command_executor) except Exception as e: log.exception('Attempt %s: Can\'t start selenium session' % attempt) last_exception = e sleep(attempt_pause) raise last_exception
def _get_log(self): try: return self.driver.get_log("logcat") except: log.exception("Cannot fetch logcat")
def fetch(self): try: self._logcat += self.driver.get_log("logcat") except: log.exception("Cannot fetch logcat")