-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use yielding pytest_runtest_call() hook wrapper
Take advantage of `@pytest.mark.hookwrapper` facility and use more idiomatic pytest_runtest_call(item) hook for performing capturing (in fact, the same is used by the core 'pytest.capture' module). Instead of messing around `report.longrepr` internals and since we don't have a `report` instance at the moment of executing pytest_runtest_call() anyway (it used to be created within a more late pytest_runtest_makereport() hook), use a higher-level item.add_report_section() method to attach log output to a report. However, there is a drawback that now reports show sections named like 'Captured stdlog ...' ('std' is hardcoded). This is an issue of the pytest itself addressed in pytest-dev/pytest#1052. That PR also contains a discussion on deprecating Item.add_report_section(), however the same approach is still used by 'pytest.capture', so it should be fine to use it here as well. This change also removes the use of the deprecated '__multicall__', so that fixes #3.
- Loading branch information
1 parent
bec9098
commit cfedc42
Showing
3 changed files
with
54 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters