Is there an easy way to append additional output to the default assertion failures?
I am able to over ride the output entirely with pytest_assertrepr_compare
but i can't seem to get the default output and add my custom message to it.
Heres what i have tried:
from _pytest.assertion.util import assertrepr_compare
def pytest_assertrepr_compare(config, op, left, right):
# append log output to normal compare
pytest_output = assertrepr_compare(config, op, left, right)
return pytest_output + ['THIS IS MY CUSTOM MESSAGE']
The assertrepr_compare
doesn't return anything in this example. Any thoughts on how to achieve this?