Override Standard Assert Messaging in Pytest Assert
问题 I'm using Pytest to test some SQL queries my team runs programmatically over time. My SQL queries are lists of JSONs - one JSON corresponds to one row of data. I've got a function that diffs the JSON key:value pairs so that we can point to exactly which values are different for a given row. Ideally, I'd output a list of these diffs instead of the standard output of an assert statement, which ends up looking clunky and not-very-useful for the end user. 回答1: Pytest give us the hook pytest