New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix logreport #10496
fix logreport #10496
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 ? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.x
branch: 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_logreport
method to get subtest reports. A report is generated forwhen='call'
, but if the test failed, thereport
is not generated. I think this is because thelog_passing_tests=True
attribute 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 using
inreport.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