[pytest-dev] Customising repr() output for super-expressions of failed assertions

Florian Bruhin me at the-compiler.org
Thu Jun 13 03:18:41 EDT 2019


On Thu, Jun 13, 2019 at 12:02:01PM +1200, Craig de Stigter wrote:
> This output isn't terribly useful at present. We'd like to automatically
> dump the request body (`r.content`) in the output, wherever it's a django
> response object, to aid debugging.

It'd be cool if this were possible with hooks (I'm not sure whether it is) -
but FWIW, what I've done so far in such situations is "print(r.content)" in the
test. That way, pytest shows you the output when a test failed, but hides it
for passing tests.


https://www.qutebrowser.org | me at the-compiler.org (Mail/XMPP)
   GPG: 916E B0C8 FD55 A072 | https://the-compiler.org/pubkey.asc
         I love long mails! | https://email.is-not-s.ms/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/pytest-dev/attachments/20190613/ed0c82eb/attachment.sig>

More information about the pytest-dev mailing list