コード例 #1
0
ファイル: test_util.py プロジェクト: kuna/controller_server
 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
ファイル: test_util.py プロジェクト: 12019/OpenWrt_Luci_Lua
 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
ファイル: reporter.py プロジェクト: samsoft00/careervacancy
    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
ファイル: reporter.py プロジェクト: ling-1/GETAiqiyiDanmu
    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
ファイル: test_util.py プロジェクト: 12019/OpenWrt_Luci_Lua
 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
ファイル: test_util.py プロジェクト: kuna/controller_server
 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
ファイル: _synctest.py プロジェクト: Architektor/PySnip
 def _exc_info(self, err):
     return util.excInfoOrFailureToExcInfo(err)
コード例 #17
0
ファイル: _synctest.py プロジェクト: PeterLUYP/2016YCProject
 def _exc_info(self, err):
     return util.excInfoOrFailureToExcInfo(err)