kevin1024 / vcrpy

Automatically mock your HTTP interactions to simplify and speed up testing
MIT License
2.65k stars 377 forks source link

body matcher gives no details when assertion fails #840

Open djowett opened 1 month ago

djowett commented 1 month ago

Is there a reason that the AssertionError in the body matcher does not supply details of the error?

It is difficult to determine some test failures without it.

This is an example of my current test output.

Matchers succeeded : ['method', 'scheme', 'host', 'port', 'path', 'query']
Matchers failed :
headers - assertion failure :
{'Accept-Encoding': 'gzip, deflate, br', 'Accept': '*/*', 'Connection': 'keep-alive', 'Content-Length': '889', 'Content-Type': 'application/json'} != {'Accept': '*/*', 'Accept-Encoding': 'gzip, deflate, br', 'Connection': 'keep-alive', 'Content-Length': '888', 'Content-Type': 'application/json'}
body - assertion failure :

(this also applies to the raw_body matcher)

I believe this was not the case before #644

If there's no good reason to avoid it, I can provide a PR to re-add it.

fiendish commented 1 week ago

I would also like this. The problem is that the body could be very big and gross. So then what? deepdiff.DeepDiff?