MCPcopy
hub / github.com/pytest-dev/pytest / addUnexpectedSuccess

Method addUnexpectedSuccess

src/_pytest/unittest.py:358–370  ·  view source on GitHub ↗
(
        self,
        testcase: unittest.TestCase,
        reason: twisted.trial.unittest.Todo | None = None,
    )

Source from the content-addressed store, hash-verified

356 self._addexcinfo(sys.exc_info())
357
358 def addUnexpectedSuccess(
359 self,
360 testcase: unittest.TestCase,
361 reason: twisted.trial.unittest.Todo | None = None,
362 ) -> None:
363 msg = "Unexpected success"
364 if reason:
365 msg += f": {reason.reason}"
366 # Preserve unittest behaviour - fail the test. Explicitly not an XPASS.
367 try:
368 fail(msg, pytrace=False)
369 except fail.Exception:
370 self._addexcinfo(sys.exc_info())
371
372 def addSuccess(self, testcase: unittest.TestCase) -> None:
373 pass

Callers

nothing calls this directly

Calls 1

_addexcinfoMethod · 0.95

Tested by

no test coverage detected