1
0
mirror of https://github.com/kevin1024/vcrpy.git synced 2025-12-09 01:03:24 +00:00

better logging when matches aren't working.

This commit is contained in:
Ivan Malison
2014-09-25 04:49:00 -07:00
parent 361ed82a10
commit 2c6f072d11

View File

@@ -38,16 +38,16 @@ def headers(r1, r2):
return r1.headers == r2.headers
def _log_matches(matches):
def _log_matches(r1, r2, matches):
differences = [m for m in matches if not m[0]]
if differences:
log.debug(
'Requests differ according to the following matchers: ' +
str(differences)
"Requests {0} and {1} differ according to "
"the following matchers: {2}".format(r1, r2, differences)
)
def requests_match(r1, r2, matchers):
matches = [(m(r1, r2), m) for m in matchers]
_log_matches(matches)
_log_matches(r1, r2, matches)
return all([m[0] for m in matches])