show expected image path for visual test failures

This commit is contained in:
Dane Springmeyer 2012-04-23 16:13:59 -07:00
parent f8c58c22c6
commit 66ff9b1492

View file

@ -27,13 +27,13 @@ def compare(fn1, fn2):
try:
im2 = Image.open(fn2)
except IOError:
errors.append((fn1, None))
errors.append((fn1, None, fn2))
return -1
diff = 0
pixels = im1.size[0] * im1.size[1]
delta_pixels = im2.size[0] * im2.size[1] - pixels
if delta_pixels != 0:
errors.append((fn1, delta_pixels))
errors.append((fn1, delta_pixels, fn2))
return delta_pixels
im1 = im1.getdata()
im2 = im2.getdata()
@ -41,7 +41,7 @@ def compare(fn1, fn2):
if(compare_pixels(im1[i], im2[i])):
diff = diff + 1
if diff != 0:
errors.append((fn1, diff))
errors.append((fn1, diff, fn2))
passed += 1
return diff
@ -55,7 +55,7 @@ def summary():
if (error[1] is None):
print "Could not verify %s: No reference image found!" % error[0]
else:
print "%s failed: %d different pixels" % error
print "%s failed: %d different pixels \n\t%s (expected)" % error
sys.exit(1)
else:
print 'All %s tests passed: \x1b[1;32m✓ \x1b[0m' % passed