def form_test_report(self, test, err=None, status=None): time = self._timeTaken() id = test.id() actions = test.test_actions priority = test.priority if not status: status = 'success' report = { 'classname': id_split(id)[0], 'name': id_split(id)[-1], 'actions': actions, 'time': time, 'status': status, 'priority': priority, 'systemout': self._getCapturedStdout(), 'systemerr': self._getCapturedStderr(), } if err: report['error'] = { 'type': nice_classname(err[0]), 'message': exc_message(err), 'tb': format_exception(err), } self.testcases.append(report)
def addSuccess(self, test, capt=None): details = None taken = self._get_time_taken() self.stats['passes'] += 1 id = test.id() test_result = { 'classname': ':'.join(id_split(id)[0].rsplit('.', 1)), 'name': id_split(id)[-1], 'id': self.external_id(test), 'time': taken, 'type': 'success', 'start': self._tsc_start, 'end': self._get_tsc_timestamp(), } # unittest.TestCase based test if hasattr(test.test, 'details'): details = test.test.details # Function based test if details is None and hasattr(test.test, 'test'): if hasattr(test.test.test, 'details'): details = test.test.test.details if details is not None: test_result.update({'details': details}) self.results.append(test_result)
def addError(self, test, err, capt=None): taken = self._get_time_taken() if issubclass(err[0], SkipTest): type = 'skipped' self.stats['skipped'] += 1 else: type = 'error' self.stats['errors'] += 1 tb = ''.join(traceback.format_exception(*err)) id = test.id() self.results.append({ 'classname': ':'.join(id_split(id)[0].rsplit('.', 1)), 'name': id_split(id)[-1], 'time': taken, 'type': type, 'errtype': nice_classname(err[0]), 'message': exc_message(err), 'tb': tb, })
def addSuccess(self, test, capt=None): taken = self._timeTaken() self.stats['passes'] += 1 id = test.id() self.results.append({ 'classname': ':'.join(id_split(id)[0].rsplit('.', 1)), 'name': id_split(id)[-1], 'time': taken, 'type': 'success', })
def addFailure(self, test, err, capt=None, tb_info=None): taken = self._timeTaken() tb = ''.join(traceback.format_exception(*err)) self.stats['failures'] += 1 id = test.id() self.results.append({ 'classname': ':'.join(id_split(id)[0].rsplit('.', 1)), 'name': id_split(id)[-1], 'time': taken, 'type': 'failure', 'errtype': nice_classname(err[0]), 'message': exc_message(err), 'tb': tb, })
def addSuccess(self, test, capt=None): taken = self._get_time_taken() self.stats['passes'] += 1 id = test.id() self.results.append({ 'classname': ':'.join(id_split(id)[0].rsplit('.', 1)), 'name': id_split(id)[-1], 'time': taken, 'type': 'success', })
def addError(self, test, err, capt=None): taken = self._get_time_taken() if issubclass(err[0], SkipTest): type = 'skipped' self.stats['skipped'] += 1 else: type = 'error' self.stats['errors'] += 1 tb = ''.join(traceback.format_exception(*err)) test_id = test.id() name = id_split(test_id)[-1] output = self._scrap_data_(exc_message(err)) self.results.append({ 'id': test_id, 'name': name, 'time': taken, 'tags': self.findTags(test, name), 'doc': self.findDoc(test, name), 'type': type, 'errtype': nice_classname(err[0]), 'ts': datetime.datetime.utcnow().isoformat(), # Too much text gets put here, can make our documents too big. #'message': exc_message(err), #'tb': tb, 'message' : output['summary'], 'tb' : output['detail'], })
def addError(self, test, err, capt=None): taken = self._timeTaken() if issubclass(err[0], SkipTest): type = 'skipped' self.stats['skipped'] += 1 else: type = 'error' self.stats['errors'] += 1 tb = ''.join(traceback.format_exception(*err)) id = test.id() self.results.append({ 'classname': ':'.join(id_split(id)[0].rsplit('.', 1)), 'name': id_split(id)[-1], 'time': taken, 'type': type, 'errtype': nice_classname(err[0]), 'message': exc_message(err), 'tb': tb, })
def addFailure(self, test, err, capt=None, tb_info=None): taken = self._get_time_taken() tb = ''.join(traceback.format_exception(*err)) self.stats['failures'] += 1 id = test.id() self.results.append({ 'classname': ':'.join(id_split(id)[0].rsplit('.', 1)), 'name': id_split(id)[-1], 'time': taken, 'type': 'failure', 'errtype': nice_classname(err[0]), 'message': exc_message(err), 'tb': tb, })
def addSuccess(self, test, capt=None): taken = self._get_time_taken() self.stats['passes'] += 1 test_id = test.id() name = id_split(test_id)[-1] self.results.append({ 'id': test_id, 'name': name, 'time': taken, 'tags': self.findTags(test, name), 'doc': self.findDoc(test, name), 'ts': datetime.datetime.utcnow().isoformat(), 'type': 'success', })
def check_id_split(self, cls, name): split = id_split('%s.%s' % (cls, name)) eq_(split[0], cls) eq_(split[1], name)