-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Add 'assert_truncate_level' to show the full diff without -vv
#10588
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 all commits
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 @@ | ||
``assert_truncate_level`` option added to be able to get the full diff without using ``-vv``. | ||
Original file line number | Diff line number | Diff line change | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -270,6 +270,10 @@ situations, for example you are shown even fixtures that start with ``_`` if you | |||||||||||
Using higher verbosity levels (``-vvv``, ``-vvvv``, ...) is supported, but has no effect in pytest itself at the moment, | ||||||||||||
however some plugins might make use of higher verbosity. | ||||||||||||
|
||||||||||||
By default for verbosity inferior to ``-vv`` really long output are truncated. It's also possible to | ||||||||||||
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 is great, but in addition to this, we should also include this option in the pytest/doc/en/reference/reference.rst Lines 1180 to 1184 in f6adebb
(Make sure to include the new option in alphabetical order) |
||||||||||||
control the truncation directly using the ``assert_truncate_level`` option. You can use ``assert_truncate_level=0`` | ||||||||||||
Pierre-Sassoulas marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||
to get the full diff regardless of the verbosity level. | ||||||||||||
|
||||||||||||
.. _`pytest.detailed_failed_tests_usage`: | ||||||||||||
|
||||||||||||
Producing a detailed summary report | ||||||||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1290,6 +1290,16 @@ def test_many_lines(): | |
] | ||
) | ||
|
||
# test assert_truncate_level ini option. | ||
result = pytester.runpytest("-o", "assert_truncate_level=1") | ||
result.stdout.fnmatch_lines( | ||
["E ...Full output truncated (2 lines hidden), use '-vv' to show"] | ||
) | ||
result = pytester.runpytest("-o", "assert_truncate_level=0") | ||
result.stdout.fnmatch_lines(["* 6*"]) | ||
result = pytester.runpytest("-v", "-o", "assert_truncate_level=0") | ||
result.stdout.fnmatch_lines(["* 6*"]) | ||
|
||
result = pytester.runpytest("-vv") | ||
result.stdout.fnmatch_lines(["* 6*"]) | ||
|
||
|
@@ -1689,7 +1699,9 @@ def test_raising_repr(): | |
""" | ||
) | ||
result = pytester.runpytest() | ||
result.stdout.fnmatch_lines(["E AssertionError: <exception str() failed>"]) | ||
result.stdout.fnmatch_lines( | ||
["E AssertionError: <unprintable AssertionError object>"] | ||
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 change should be reverted it seems. 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. Right, it's strange I had an issue locally. |
||
) | ||
|
||
|
||
def test_issue_1944(pytester: Pytester) -> None: | ||
|
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.
By using
confval
as I mentioned before, we can create a link to it automatically: