Пример #1
0
 def __init__(self, stream, descriptions, verbosity):
     TextTestResult.__init__(self, stream, descriptions, verbosity)
     self.__suite_start_time = None
     self.__suite_end_time = None
     self.__start_test_time = None
     self.__end_test_time = None
     self.__init_props()
Пример #2
0
    def addSubTest(self, test, subtest, err):
        """Called at the end of a subtest. 
		'err' is None if the subtest ended successfully, otherwise it's a
		tuple of values as returned by sys.exc_info().
		"""
        TextTestResult.addSubTest(self, test, subtest, err)
        pass
Пример #3
0
 def __init__(self, *args, **kwargs):
     self.logger = kwargs.pop('logger')
     self.test_list = kwargs.pop("test_list", [])
     self.result_callbacks = kwargs.pop('result_callbacks', [])
     self.passed = 0
     self.testsRun = 0
     TextTestResult.__init__(self, *args, **kwargs)
Пример #4
0
 def addFailure(self, test, err):
     """Called when an error has occurred. 'err' is a tuple of values as returned by sys.exc_info()."""
     TextTestResult.addFailure(self, test, err)
     self._bmMessage({
         'Type': 'Failure',
         'Err': format_exception(*err)
     }, test)
Пример #5
0
 def __init__(self, *args, **kwargs):
     self.logger = kwargs.pop('logger')
     self.test_list = kwargs.pop("test_list", [])
     self.result_callbacks = kwargs.pop('result_callbacks', [])
     self.passed = 0
     self.testsRun = 0
     TextTestResult.__init__(self, *args, **kwargs)
Пример #6
0
 def addExpectedFailure(self, test, err):
     """Called when an expected failure/error occurred."""
     TextTestResult.addExpectedFailure(self, test, err)
     self._bmMessage(
         {
             'Type': 'ExpectedFailure',
             'Err': format_exception(*err)
         }, test)
Пример #7
0
 def __init__(self, stream=sys.stderr, descriptions=1, verbosity=1,
              elapsed_times=True):
     "Create a new instance of _XMLTestResult."
     TextTestResult.__init__(self, stream, descriptions, verbosity)
     self.successes = []
     self.callback = None
     self.elapsed_times = elapsed_times
     self.output_patched = False
Пример #8
0
    def stopTest(self, test):
        """ Called after excute each test method. """
        self._save_output_data()
        TextTestResult.stopTest(self, test)
        self.stop_time = time.time()

        if self.callback and callable(self.callback):
            self.callback()
            self.callback = None
Пример #9
0
    def stopTest(self, test):
        "Called after execute each test method."
        self._restore_standard_output()
        TextTestResult.stopTest(self, test)
        self.stop_time = time.time()

        if self.callback and callable(self.callback):
            self.callback()
            self.callback = None
Пример #10
0
 def __init__(self, stream, descriptions, verbosity):
     TextTestResult.__init__(self, stream, descriptions, verbosity)
     self.buffer = True
     self._stdout_data = None
     self._stderr_data = None
     self.successes = []
     self.callback = None
     self.infoclass = _TestInfo
     self.report_files = []
Пример #11
0
Файл: mpi.py Проект: zonca/toast
    def stopTest(self, test):
        """
        Called after executing each test method.
        """
        self._save_output_data()
        TextTestResult.stopTest(self, test)
        self.comm.Barrier()
        self.stop_time = MPI.Wtime()

        if self.callback and callable(self.callback):
            self.callback()
            self.callback = None
Пример #12
0
 def stopTest(self, test):
     """ Called after excute each test method. """
     self._save_output_data()
     TextTestResult.stopTest(self, test)
     self.stop_time = time.time()
     
     ''' capture warning message in each of test '''
     del self.catch_warn
     
     if self.callback and callable(self.callback):
         self.callback()
         self.callback = None
Пример #13
0
Файл: mpi.py Проект: zonca/toast
 def __init__(self, comm, stream, descriptions=1, verbosity=1):
     self.comm = comm
     self.rank = self.comm.rank
     self.size = self.comm.size
     self.stream = stream
     TextTestResult.__init__(self, self.stream, descriptions, verbosity)
     self.buffer = True  # we are capturing test output
     self._stdout_data = None
     self._stderr_data = None
     self.successes = []
     self.callback = None
     self.properties = None  # junit testsuite properties
Пример #14
0
 def stopTest(self, test):
     """Called when the given test has been run"""
     message = {
         'Type':
         'StopCase',
         'Output':
         self._stdout_buffer.getvalue()
         if self.buffer and self._stdout_buffer is not None else '',
         'Error':
         self._stderr_buffer.getvalue()
         if self.buffer and self._stderr_buffer is not None else ''
     }
     TextTestResult.stopTest(self, test)
     self._bmMessage(message, test)
Пример #15
0
    def addFailure(self, test, err):
        """ it report that a test is failed
    @param test: an object of a calling test class
    @type test: TestCase
    @param err: a tuple of values as returned by sys.exc_info().
    """
        TextTestResult.addFailure(self, test, err)

        # pylint: disable=W0212
        key = "%s.%s" % (test.__class__.__name__, test._testMethodName)

        if (self._results is not None):
            # calculate a unique key
            key = self._calculate_unique_key(key)

            self._results.Fail({key: self._exc_info_to_string(err, test)})
Пример #16
0
  def addFailure(self, test, err):
    """ it report that a test is failed
    @param test: an object of a calling test class
    @type test: TestCase
    @param err: a tuple of values as returned by sys.exc_info().
    """
    TextTestResult.addFailure(self, test, err)

    # pylint: disable=W0212
    key = "%s.%s" % (test.__class__.__name__, test._testMethodName)

    if (self._results is not None):
      # calculate a unique key
      key = self._calculate_unique_key(key)

      self._results.Fail({key: self._exc_info_to_string(err, test)})
    def printErrors(self):
        TextTestResult.printErrors(self)
        reasons = {}
        for test, reason in self.skipped:
            tests = reasons.get(reason, [])
            tests.append(test)
            reasons[reason] = tests

        if reasons:
            self.stream.writeln(self.separator1)

        for reason, tests in reasons.iteritems():
            self.stream.write('SKIP: ')
            self.stream.writeln('%dx %s' % (len(tests), reason))
            if self.showAll:
                for test in tests:
                    self.stream.writeln('  ' + '.'.join([
                        test.__class__.__module__.split('.')[-1],
                        test.__class__.__name__,
                        test._testMethodName
                    ]))

        if reasons:
            self.stream.writeln()
Пример #18
0
    def __init__(self, stream, descriptions, verbosity):
        TextTestResult.__init__(self, stream, descriptions, verbosity)
        self.buffer = False
        self._stdout_data = None
        self._stderr_data = None
        self.successes = []
        self.subtests = {}
        self.callback = None
        self.infoclass = _TestInfo
        self.report_files = []

        self.outputBuffer = StringIO.StringIO()
        self.stdout0 = None
        self.stderr0 = None
        self.verbosity = verbosity

        # result is a list of result in 5 tuple
        # (
        #   result code (0: success; 1: fail; 2: error; 3: skip),
        #   TestCase object,
        #   Test output (byte string),
        #   stack trace,
        # )
        self.result = []
Пример #19
0
 def addSuccess(self, test):
     TextTestResult.addSuccess(self, test)
     self.report.add_assertion(test, True)
Пример #20
0
 def addFailure(self, test, err):
     TextTestResult.addFailure(self, test, err)
     self.report.add_assertion(test, False)
Пример #21
0
 def addError(self, test, err):
     TextTestResult.addError(self, test, err)
     self.report.add_assertion(test, False)
 def addError(self, test, err):
     TextTestResult.addError(self, test, err)
Пример #23
0
 def addSuccess(self, test):
     """Called when a test has completed successfully"""
     TextTestResult.addSuccess(self, test)
     self._bmMessage({'Type': 'Success'}, test)
Пример #24
0
 def printErrorList(self, flavour, errors):
     flavour = hilite(flavour, RED, bold=flavour == 'ERROR')
     TextTestResult.printErrorList(self, flavour, errors)
Пример #25
0
 def addError(self, test, err):
     TextTestResult.addError(self, test, err)
     self.stream.log.write("ERROR\n")
     self.stream.log.flush()
Пример #26
0
 def addFailure(self, test, err):
     TextTestResult.addFailure(self, test, err)
     self.report.add_assertion(test, False)
Пример #27
0
 def __init__(self, stream, descriptions, verbosity):
     TextTestResult.__init__(self, stream, descriptions, verbosity)
     self.report = EarlReport()
 def addUnexpectedSuccess(self, test):
     TextTestResult.addUnexpectedSuccess(self, test)
Пример #29
0
 def addSkip(self, test, reason):
     """Called when a test is skipped."""
     TextTestResult.addSkip(self, test, reason)
     self._bmMessage({'Type': 'Skip', 'Message': reason}, test)
Пример #30
0
 def startTest(self, test):
     """Called when the given test is about to be run"""
     TextTestResult.startTest(self, test)
     self._bmMessage({'Type': 'StartCase'}, test)
 def addExpectedFailure(self, test, err):
     TextTestResult.addExpectedFailure(self, test, err)
Пример #32
0
 def addSkip(self, test, reason):
     TextTestResult.addSkip(self, test, reason)
     self.stream.log.write("skipped\n")
     self.stream.log.flush()
Пример #33
0
 def setUp(self):
     self.spider = TestBeibeiSpider()
     self.conman = ContractsManager(self.contracts)
     self.results = TextTestResult(stream=None,
                                   descriptions=False,
                                   verbosity=0)
Пример #34
0
 def printErrorList(self, flavour, errors):
     flavour = hilite(flavour, RED, bold=flavour == 'ERROR')
     TextTestResult.printErrorList(self, flavour, errors)
 def addSkip(self, test, reason):
     TextTestResult.addSkip(self, test, reason)
Пример #36
0
 def __init__(self, stream, descriptions, verbosity):
     TextTestResult.__init__(self, stream, descriptions, verbosity)
     self.report = EarlReport()
Пример #37
0
 def addFailure(self, test, err):
     TextTestResult.addFailure(self, test, err)
     self.stream.log.write("FAIL\n")
     self.stream.log.flush()
Пример #38
0
 def addUnexpectedSuccess(self, test):
     """Called when a test was expected to fail, but succeed."""
     TextTestResult.addUnexpectedSuccess(self, test)
     self._bmMessage({'Type': 'UnexpectedSuccess'}, test)
Пример #39
0
 def addError(self, test, err):
     TextTestResult.addError(self, test, err)
     self.report.add_assertion(test, False)
Пример #40
0
 def startTest(self, test):
     TextTestResult.startTest(self, test)
     self.stream.log.write(str(test))
     self.stream.log.write(" ... ")
     self.stream.log.flush()
Пример #41
0
 def addSuccess(self, test):
     TextTestResult.addSuccess(self, test)
     self.report.add_assertion(test, True)
Пример #42
0
 def addSuccess(self, test):
     TextTestResult.addSuccess(self, test)
     self.stream.log.write("ok\n")
     self.stream.log.flush()