예제 #1
0
 def test_excInfo(self):
     """
     L{excInfoOrFailureToExcInfo} returns exactly what it is passed, if it is
     passed a tuple like the one returned by L{sys.exc_info}.
     """
     info = (ValueError, ValueError("foo"), None)
     self.assertTrue(info is excInfoOrFailureToExcInfo(info))
예제 #2
0
 def test_excInfo(self):
     """
     L{excInfoOrFailureToExcInfo} returns exactly what it is passed, if it is
     passed a tuple like the one returned by L{sys.exc_info}.
     """
     info = (ValueError, ValueError("foo"), None)
     self.assertTrue(info is excInfoOrFailureToExcInfo(info))
예제 #3
0
    def addFailure(self, test, err):
        """
        Record that C{test} failed an assertion with the error C{err}.

        Also marks the run as being unsuccessful, causing
        L{SubunitReporter.wasSuccessful} to return C{False}.
        """
        self._successful = False
        return self._subunit.addFailure(test, util.excInfoOrFailureToExcInfo(err))
예제 #4
0
 def addFailure(self, test, err):
     """
     Record that ``test`` failed an assertion with the error ``err``.
     """
     self.progress_stream.write(self._FAIL_MARK)
     return self._subunit.addFailure(
         test,
         excInfoOrFailureToExcInfo(err),
     )
예제 #5
0
    def addFailure(self, test, err):
        """
        Record that C{test} failed an assertion with the error C{err}.

        Also marks the run as being unsuccessful, causing
        L{SubunitReporter.wasSuccessful} to return C{False}.
        """
        self._successful = False
        return self._subunit.addFailure(test, util.excInfoOrFailureToExcInfo(err))
예제 #6
0
 def addExpectedFailure(self, test, failure, todo):
     """
     Record an expected failure from a test.
     """
     self.progress_stream.write(self._XFAIL_MARK)
     self._subunit.addExpectedFailure(
         test,
         excInfoOrFailureToExcInfo(failure),
     )
예제 #7
0
 def addError(self, test, err):
     """
     Record that ``test`` failed with an unexpected error ``err``.
     """
     self.progress_stream.write(self._ERROR_MARK)
     return self._subunit.addError(
         test,
         excInfoOrFailureToExcInfo(err),
     )
예제 #8
0
파일: runner.py 프로젝트: shelmesky/twisted
    def __init__(self, description, error):
        """
        @param description: A string used by C{TestResult}s to identify this
        error. Generally, this is the name of a module that failed to import.

        @param error: The error to be added to the result. Can be an `exc_info`
        tuple or a L{twisted.python.failure.Failure}.
        """
        super(ErrorHolder, self).__init__(description)
        self.error = util.excInfoOrFailureToExcInfo(error)
예제 #9
0
파일: runner.py 프로젝트: antong/twisted
    def run(self, result):
        """
        Run the test, reporting the error.

        @param result: The C{TestResult} to store the results in.
        @type result: L{twisted.trial.itrial.ITestResult}.
        """
        result.startTest(self)
        result.addError(self, util.excInfoOrFailureToExcInfo(self.error))
        result.stopTest(self)
예제 #10
0
    def run(self, result):
        """
        Run the test, reporting the error.

        @param result: The C{TestResult} to store the results in.
        @type result: L{twisted.trial.itrial.ITestResult}.
        """
        result.startTest(self)
        result.addError(self, util.excInfoOrFailureToExcInfo(self.error))
        result.stopTest(self)
예제 #11
0
파일: runner.py 프로젝트: zerospam/twisted
    def __init__(self, description, error):
        """
        @param description: A string used by C{TestResult}s to identify this
        error. Generally, this is the name of a module that failed to import.

        @param error: The error to be added to the result. Can be an `exc_info`
        tuple or a L{twisted.python.failure.Failure}.
        """
        super(ErrorHolder, self).__init__(description)
        self.error = util.excInfoOrFailureToExcInfo(error)
예제 #12
0
 def test_failure(self):
     """
     When called with a L{Failure} instance, L{excInfoOrFailureToExcInfo}
     returns a tuple like the one returned by L{sys.exc_info}, with the
     elements taken from the type, value, and traceback of the failure.
     """
     try:
         1 / 0
     except:
         f = Failure()
     self.assertEqual((f.type, f.value, f.tb), excInfoOrFailureToExcInfo(f))
예제 #13
0
 def test_failure(self):
     """
     When called with a L{Failure} instance, L{excInfoOrFailureToExcInfo}
     returns a tuple like the one returned by L{sys.exc_info}, with the
     elements taken from the type, value, and traceback of the failure.
     """
     try:
         1 / 0
     except:
         f = Failure()
     self.assertEqual((f.type, f.value, f.tb), excInfoOrFailureToExcInfo(f))
예제 #14
0
파일: reporter.py 프로젝트: ppker/twisted
    def addExpectedFailure(self, test, failure, todo=None):
        """
        Record an expected failure from a test.

        Some versions of subunit do not implement this. For those versions, we
        record a success.
        """
        failure = util.excInfoOrFailureToExcInfo(failure)
        addExpectedFailure = getattr(self._subunit, "addExpectedFailure", None)
        if addExpectedFailure is None:
            self.addSuccess(test)
        else:
            addExpectedFailure(test, failure)
예제 #15
0
파일: reporter.py 프로젝트: hensing/twisted
    def addExpectedFailure(self, test, failure, todo):
        """
        Record an expected failure from a test.

        Some versions of subunit do not implement this. For those versions, we
        record a success.
        """
        failure = util.excInfoOrFailureToExcInfo(failure)
        addExpectedFailure = getattr(self._subunit, 'addExpectedFailure', None)
        if addExpectedFailure is None:
            self.addSuccess(test)
        else:
            addExpectedFailure(test, failure)
예제 #16
0
 def _exc_info(self, err):
     return util.excInfoOrFailureToExcInfo(err)
예제 #17
0
 def _exc_info(self, err):
     return util.excInfoOrFailureToExcInfo(err)