示例#1
0
    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)
示例#2
0
    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)
示例#3
0
    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,
        })
示例#4
0
    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)
示例#5
0
 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',
     })
示例#6
0
 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,
     })
示例#7
0
 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',
     })
示例#8
0
    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'],
        })
示例#9
0
    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,
        })
示例#10
0
 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,
     })
示例#11
0
 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',
     })
示例#12
0
 def check_id_split(self, cls, name):
     split = id_split('%s.%s' % (cls, name))
     eq_(split[0], cls)
     eq_(split[1], name)
示例#13
0
 def check_id_split(self, cls, name):
     split = id_split('%s.%s' % (cls, name))
     eq_(split[0], cls)
     eq_(split[1], name)