fix logreport#10496
fix logreport#10496anb76ru wants to merge 26 commits intopytest-dev:mainfrom anb76ru:7.2.0/anb76ru/fix_logreport
Conversation
Prepare release 7.2.0
Co-authored-by: Florian Bruhin <me@the-compiler.org>
[7.2.x] upgrade pygments-pytest for 7.2.x coloring
[7.2.x] Add the PyPI classifier for Python 3.11
Use specific tag in the gh-action-pypi-publish action
[2.7.x] Use specific tag in the gh-action-pypi-publish action
…in Python 3.12 (#10453) Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
Co-authored-by: Florian Bruhin <me@the-compiler.org>
[7.2.x] Fix test_raising_repr test
nicoddemus
left a comment
There was a problem hiding this comment.
Thanks! The fix does make sense.
I also noticed that write_captured_output should be called in the start of the function, in the if report.passed/if report.when == "call", otherwise passing tests won't output the captured output even if log_passing_tests is True.
We also need tests and a changelog entry. 👍
1. add call write_captured_output for condition report.passed 2. add info into changelog
This reverts commit 5bee912.
|
@nicoddemus , if Therefore, I moved the condition Please, check PR |
|
@nicoddemus, can you review, please ? |
nicoddemus
left a comment
There was a problem hiding this comment.
Therefore, I moved the condition if not self.log_passing_tests in if report.passed / if report.when == "call". But I am not sure about the correctness of these changes
Hmm OK, let's remove that. I think that handling could be done more cleanly, but that's out of scope for this PR.
We still need some other changes though:
- Add a test for your change (we don't want it to regress in the future)
- Rebase and target
main, instead of the7.2.xbranch: we always land bug fixes inmain, and do a backport later.
1. add call write_captured_output for condition report.passed 2. add info into changelog
This reverts commit 5bee912.
…6ru/pytest into 7.2.0/anb76ru/fix_logreport
|
@nicoddemus I remove |
|
@nicoddemus, Hello. Please check my changes |
|
Closing as per #10491 (comment). Sorry again for the misunderstanding of the use case, and thanks for the effort @anb76ru! |

Hello! I use the
pytest_runtest_logreportmethod to get subtest reports. A report is generated forwhen='call', but if the test failed, thereportis not generated. I think this is because thelog_passing_tests=Trueattribute is used in theelif report.failed:block. If the test failed, then ifwhen == 'call'we don't step into the code block:and the report is not generated. I don't understand why
self.log_passing_test usinginreport.failed. Maybe this is a mistake. If you remove the 'if not self.log_passing_tests:', then the report for the failed tests forwhen='call'is generated without problems.I suggest making
reporter.write_captured_output(report)unconditional##10491
OS: win10

pytest_ver: #7.2.0