Implement the internals of the pytest_runtest_xxx() hooks.
(self, item: nodes.Item, when: str)
| 826 | |
| 827 | @contextmanager |
| 828 | def _runtest_for(self, item: nodes.Item, when: str) -> Generator[None]: |
| 829 | class="st">""class="st">"Implement the internals of the pytest_runtest_xxx() hooks."class="st">"" |
| 830 | with ( |
| 831 | catching_logs( |
| 832 | self.caplog_handler, |
| 833 | level=self.log_level, |
| 834 | ) as caplog_handler, |
| 835 | catching_logs( |
| 836 | self.report_handler, |
| 837 | level=self.log_level, |
| 838 | ) as report_handler, |
| 839 | ): |
| 840 | caplog_handler.reset() |
| 841 | report_handler.reset() |
| 842 | item.stash[caplog_records_key][when] = caplog_handler.records |
| 843 | item.stash[caplog_handler_key] = caplog_handler |
| 844 | |
| 845 | try: |
| 846 | yield |
| 847 | finally: |
| 848 | log = report_handler.stream.getvalue().strip() |
| 849 | item.add_report_section(when, class="st">"log", log) |
| 850 | |
| 851 | @hookimpl(wrapper=True) |
| 852 | def pytest_runtest_setup(self, item: nodes.Item) -> Generator[None]: |
no test coverage detected