-
-
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
Add 'assert_truncate_level' to show the full diff without -vv
#10588
Conversation
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 a lot @Pierre-Sassoulas, we really appreciate it!
As for the option name, assert_truncate_level
reads strange to me, given assert
is a verb. Perhaps we should use assertion_truncate_level
? I'm not a native English speaker, so would appreciate if others share their opinions.
@@ -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 comment
The 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 Configuration Options
section in reference.rst
, making use of the confval
directive, for example:
pytest/doc/en/reference/reference.rst
Lines 1180 to 1184 in f6adebb
.. confval:: addopts | |
Add the specified ``OPTS`` to the set of command line arguments as if they | |
had been specified by the user. Example: if you have this ini file content: | |
(Make sure to include the new option in alphabetical order)
@@ -0,0 +1 @@ | |||
``assert_truncate_level`` option added to be able to get the full diff without using ``-vv``. |
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:
``assert_truncate_level`` option added to be able to get the full diff without using ``-vv``. | |
:confval:`assert_truncate_level` option added to be able to get the full diff without using ``-vv``. |
@@ -1664,7 +1674,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 comment
The 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 comment
The reason will be displayed to describe this comment to others. Learn more.
Right, it's strange I had an issue locally.
I agree. |
The second makes sense if we will be using it for other things than just the |
Closes pytest-dev#3962 Co-authored-by: Daniel Hahler <[email protected]>
f008919
to
99451f9
Compare
Closing as it was done in #11473 |
Add an option to get the full diff regardless of the verbosity.
This would Closes #3962
Co-authored-by: Daniel Hahler [email protected] (expanded from it and adapted from the fork. I kept the option name but changing it wouldn't be that hard).