[pytest-dev] Using pytest_assertrepr_compare() for marked tests only?

Florian Bruhin me at the-compiler.org
Mon May 13 05:06:16 EDT 2019


On Sun, May 12, 2019 at 07:44:01PM -0400, Shawn Brown wrote:
> So I have a few related questions I'm hoping someone can help me with:
> 
> Q: Is there a way to reference the current test from within
> pytest_assertrepr_compare()?
> 
> Q: If not, is there a decent way to implement something like this that
> isn't too hacky?

In your own code, you probably can't do so easily.

However, pytest itself does have access to the item when calling
pytest_assertrepr_compare - so you might want to consider submitting a
contribution to pytest to pass the item to the hook as well! :)

Florian

-- 
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/20190513/5c2a3ede/attachment.sig>


More information about the pytest-dev mailing list