MCPcopy Create free account
hub / github.com/pytest-dev/pytest / __exit__

Method __exit__

src/_pytest/python_api.py:944–961  ·  view source on GitHub ↗
(
        self,
        exc_type: Optional[Type[BaseException]],
        exc_val: Optional[BaseException],
        exc_tb: Optional[TracebackType],
    )

Source from the content-addressed store, hash-verified

942 return self.excinfo
943
944 def __exit__(
945 self,
946 exc_type: Optional[Type[BaseException]],
947 exc_val: Optional[BaseException],
948 exc_tb: Optional[TracebackType],
949 ) -> bool:
950 __tracebackhide__ = True
951 if exc_type is None:
952 fail(self.message)
953 assert self.excinfo is not None
954 if not issubclass(exc_type, self.expected_exception):
955 return False
956 # Cast to narrow the exception type now that it's verified.
957 exc_info = cast(Tuple[Type[E], E, TracebackType], (exc_type, exc_val, exc_tb))
958 self.excinfo.fill_unfilled(exc_info)
959 if self.match_expr is not None:
960 self.excinfo.match(self.match_expr)
961 return True

Callers

nothing calls this directly

Calls 3

failFunction · 0.90
fill_unfilledMethod · 0.80
matchMethod · 0.80

Tested by

no test coverage detected