[pytest-dev] Custom reporting for asserts without comparison operators?

Shawn Brown 03sjbrown at gmail.com
Sun Mar 18 17:11:48 EDT 2018

If I could somehow trigger pytest_assertrepr_compare() so it would receive
op=None, left=myresult, right=None (or something similar), then I could
handle failing cases by getting the needed information from a property of a
Falsy return value.

I'm also wondering: might it be possible to use pytest_addhooks() to add a
hook to modify the AST or even modify the pre-parsed source? If I could
automatically re-write "assert myfunc(myobj)" but leave other cases
unchanged, this would clean things up for me. Although as I mentioned
earlier, I don't see a way to interact with the AST or the
AssertionRewriter within pytest's plugin system.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/pytest-dev/attachments/20180318/6d04691c/attachment.html>

More information about the pytest-dev mailing list