-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Closed
Labels
topic: rewriterelated to the assertion rewrite mechanismrelated to the assertion rewrite mechanismtype: enhancementnew feature or API change, should be merged into features branchnew feature or API change, should be merged into features branch
Description
Pytest version 3.10.1, also seen on Ubuntu 19.04:
With -v, when the output of a failure is close to the truncation limit, verbosity is increased, and the extra words are not useful. In short, this:
$ py.test-3 -v | wc
60 269 3287
$ py.test-3 -vv | wc
59 272 3292
In addition the truncation message is misleading in the number of truncated lines. With -v:
E assert b'<!DOCTYPE H...cation.</p>\n' == b'{}'
E At index 0 diff: 60 != 123
E Left contains more items, first extra item: 68
E Full diff:
E + b'{}'
E - (b'<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">\n<title>500 Inter'
E - b'nal Server Error</title>\n<h1>Internal Server Error</h1>\n<p>The server en'
E - b'countered an internal error and was unable to complete your request. Either'...
E
E ...Full output truncated (2 lines hidden), use '-vv' to show
With -vv:
E assert b'<!DOCTYPE H...cation.</p>\n' == b'{}'
E At index 0 diff: 60 != 123
E Left contains more items, first extra item: 68
E Full diff:
E + b'{}'
E - (b'<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">\n<title>500 Inter'
E - b'nal Server Error</title>\n<h1>Internal Server Error</h1>\n<p>The server en'
E - b'countered an internal error and was unable to complete your request. Either'
E - b' the server is overloaded or there is an error in the application.</p>\n')
That looks one extra line to me, not two. Possibly lines are counted by splitting on \n, and the message has a terminating \n, technically leaving an empty line at the end -- but this empty line is not shown in the -vv output.
it would be better for pytest to print the one line of error, rather than the two lines making an inaccurate claim about the truncation.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
topic: rewriterelated to the assertion rewrite mechanismrelated to the assertion rewrite mechanismtype: enhancementnew feature or API change, should be merged into features branchnew feature or API change, should be merged into features branch