(
item: Item, when: Literal["setup", "call", "teardown"], log: bool = True, **kwds
)
| 234 | |
| 235 | |
| 236 | def call_and_report( |
| 237 | item: Item, when: Literal["setup", "call", "teardown"], log: bool = True, **kwds |
| 238 | ) -> TestReport: |
| 239 | ihook = item.ihook |
| 240 | if when == "setup": |
| 241 | runtest_hook: Callable[..., None] = ihook.pytest_runtest_setup |
| 242 | elif when == "call": |
| 243 | runtest_hook = ihook.pytest_runtest_call |
| 244 | elif when == "teardown": |
| 245 | runtest_hook = ihook.pytest_runtest_teardown |
| 246 | else: |
| 247 | assert False, f"Unhandled runtest hook case: {when}" |
| 248 | |
| 249 | call = CallInfo.from_call( |
| 250 | lambda: runtest_hook(item=item, **kwds), |
| 251 | when=when, |
| 252 | reraise=get_reraise_exceptions(item.config), |
| 253 | ) |
| 254 | report: TestReport = ihook.pytest_runtest_makereport(item=item, call=call) |
| 255 | if log: |
| 256 | ihook.pytest_runtest_logreport(report=report) |
| 257 | if check_interactive_exception(call, report): |
| 258 | ihook.pytest_exception_interact(node=item, call=call, report=report) |
| 259 | return report |
| 260 | |
| 261 | |
| 262 | def get_reraise_exceptions(config: Config) -> tuple[type[BaseException], ...]: |
no test coverage detected