-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Handled CollectReport without duration attribute in terminal report #13573
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
Changes from 2 commits
7c9cf56
1ef62bc
6adf54e
d263824
aa02cab
351b3f4
9566c9f
bb03a4b
25c8c0a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
from __future__ import annotations | ||
|
||
from _pytest.pytester import Pytester | ||
|
||
|
||
def test_console_output_style_times_with_skipped_and_passed(pytester: Pytester) -> None: | ||
pytester.makepyfile( | ||
test_repro=""" | ||
def test_hello(): | ||
pass | ||
""", | ||
test_repro_skip=""" | ||
import pytest | ||
pytest.importorskip("fakepackage_does_not_exist") | ||
""", | ||
) | ||
|
||
result = pytester.runpytest( | ||
"test_repro.py", | ||
"test_repro_skip.py", | ||
"-o", | ||
"console_output_style=times", | ||
) | ||
|
||
print("Captured stdout:") | ||
print(result.stdout.str()) | ||
print("Captured stderr:") | ||
print(result.stderr.str()) | ||
|
||
combined = result.stdout.lines + result.stderr.lines | ||
assert any( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not sure I follow, doesn't the change in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this fix mainly prevents the AttributeError from showing up, which is expected now asthe bug is resolved. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. But the fact that the bug is fixed, means that the message does not show up, correct? |
||
"'CollectReport' object has no attribute 'duration'" in line | ||
for line in combined | ||
) | ||
coder-aditi marked this conversation as resolved.
Show resolved
Hide resolved
|
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.
Any reason why this test is not added to
test_terminal.py
?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.
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
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.
Yes please. 👍