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

Method _addexcinfo

src/_pytest/unittest.py:265–297  ·  src/_pytest/unittest.py::TestCaseFunction._addexcinfo
(self, rawexcinfo: _SysExcInfoType)

Source from the content-addressed store, hash-verified

263 pass
264
265 def _addexcinfo(self, rawexcinfo: _SysExcInfoType) -> None:
266 rawexcinfo = _handle_twisted_exc_info(rawexcinfo)
267 try:
268 excinfo = _pytest._code.ExceptionInfo[BaseException].from_exc_info(
269 rawexcinfo class="cm"># type: ignore[arg-type]
270 )
271 class="cm"># Invoke the attributes to trigger storing the traceback
272 class="cm"># trial causes some issue there.
273 _ = excinfo.value
274 _ = excinfo.traceback
275 except TypeError:
276 try:
277 try:
278 values = traceback.format_exception(*rawexcinfo)
279 values.insert(
280 0,
281 class="st">"NOTE: Incompatible Exception Representation, "
282 class="st">"displaying natively:\n\n",
283 )
284 fail(class="st">"".join(values), pytrace=False)
285 except (fail.Exception, KeyboardInterrupt):
286 raise
287 except BaseException:
288 fail(
289 class="st">"ERROR: Unknown Incompatible Exception "
290 fclass="st">"representation:\n{rawexcinfo!r}",
291 pytrace=False,
292 )
293 except KeyboardInterrupt:
294 raise
295 except fail.Exception:
296 excinfo = _pytest._code.ExceptionInfo.from_current()
297 self.__dict__.setdefault(class="st">"_excinfo", []).append(excinfo)
298
299 def addError(
300 self, testcase: unittest.TestCase, rawexcinfo: _SysExcInfoType

Callers 5

addErrorMethod · 0.95
addFailureMethod · 0.95
add_skipMethod · 0.95
addExpectedFailureMethod · 0.95
addUnexpectedSuccessMethod · 0.95

Calls 7

_handle_twisted_exc_infoFunction · 0.85
from_exc_infoMethod · 0.80
insertMethod · 0.80
joinMethod · 0.80
from_currentMethod · 0.80
appendMethod · 0.80
setdefaultMethod · 0.80

Tested by

no test coverage detected