(
self,
exc_type: type[BaseException] | None,
exc_val: BaseException | None,
exc_tb: TracebackType | None,
)
| 228 | ) |
| 229 | |
| 230 | def __exit__( |
| 231 | self, |
| 232 | exc_type: type[BaseException] | None, |
| 233 | exc_val: BaseException | None, |
| 234 | exc_tb: TracebackType | None, |
| 235 | ) -> bool: |
| 236 | __tracebackhide__ = True |
| 237 | if exc_val is not None: |
| 238 | exc_info = ExceptionInfo.from_exception(exc_val) |
| 239 | else: |
| 240 | exc_info = None |
| 241 | |
| 242 | self._exit_stack.close() |
| 243 | |
| 244 | precise_stop = time.perf_counter() |
| 245 | duration = precise_stop - self._precise_start |
| 246 | stop = time.time() |
| 247 | |
| 248 | call_info = CallInfo[None]( |
| 249 | None, |
| 250 | exc_info, |
| 251 | start=self._start, |
| 252 | stop=stop, |
| 253 | duration=duration, |
| 254 | when="call", |
| 255 | _ispytest=True, |
| 256 | ) |
| 257 | report = self.ihook.pytest_runtest_makereport( |
| 258 | item=self.request.node, call=call_info |
| 259 | ) |
| 260 | sub_report = SubtestReport._new( |
| 261 | report, |
| 262 | SubtestContext(msg=self.msg, kwargs=self.kwargs), |
| 263 | captured_output=self._captured_output, |
| 264 | captured_logs=self._captured_logs, |
| 265 | ) |
| 266 | |
| 267 | if sub_report.failed: |
| 268 | failed_subtests = self.config.stash[failed_subtests_key] |
| 269 | failed_subtests[self.request.node.nodeid] += 1 |
| 270 | |
| 271 | with self.suspend_capture_ctx(): |
| 272 | self.ihook.pytest_runtest_logreport(report=sub_report) |
| 273 | |
| 274 | if check_interactive_exception(call_info, sub_report): |
| 275 | self.ihook.pytest_exception_interact( |
| 276 | node=self.request.node, call=call_info, report=sub_report |
| 277 | ) |
| 278 | |
| 279 | if exc_val is not None: |
| 280 | if isinstance(exc_val, get_reraise_exceptions(self.config)): |
| 281 | return False |
| 282 | if self.request.session.shouldfail: |
| 283 | return False |
| 284 | return True |
| 285 | |
| 286 | |
| 287 | @contextmanager |
nothing calls this directly
no test coverage detected