Handled CollectReport without duration attribute in terminal report#13573
Conversation
testing/test_terminal_report.py
Outdated
| print(result.stderr.str()) | ||
|
|
||
| combined = result.stdout.lines + result.stderr.lines | ||
| assert any( |
There was a problem hiding this comment.
Not sure I follow, doesn't the change in terminal.py prevents this message from appearing in the command line?
There was a problem hiding this comment.
this fix mainly prevents the AttributeError from showing up, which is expected now asthe bug is resolved.
There was a problem hiding this comment.
But the fact that the bug is fixed, means that the message does not show up, correct? any is testing that it should show up, which is wrong.
testing/test_terminal_report.py
Outdated
| from _pytest.pytester import Pytester | ||
|
|
||
|
|
||
| def test_console_output_style_times_with_skipped_and_passed(pytester: Pytester) -> None: |
There was a problem hiding this comment.
Any reason why this test is not added to test_terminal.py?
There was a problem hiding this comment.
Hi @nicoddemus , test_terminal.py was already existing,, so thought of making another new unit test file. Shall I add this in that existing file only? please let me know
Co-authored-by: Bruno Oliveira <bruno@soliv.dev>
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
|
Hi @nicoddemus , I made the necessary changes, please review and let me know. Thank you. |
Backport to 8.4.x: 💚 backport PR created✅ Backport PR branch: Backported as #13579 🤖 @patchback |
) Fixes pytest-dev#13478 --------- Co-authored-by: AD <mysideuse@gmail.com> Co-authored-by: Bruno Oliveira <bruno@pytest.org>
Fix #13478
This PR adds a regression test to fix a bug in console_output_style=times that, because it lacks the duration attribute, caused a crash when a CollectReport object (from a skipped test) was included. The test helps stop future regressions and verifies that the problem no longer exists.