Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Better failure messages for assertScreenshot

  • Loading branch information...
commit 079a718ce8115679c224e7477c13529c6c3d8e10 1 parent e26e9b5
@bfirsh authored
Showing with 7 additions and 1 deletion.
  1. +7 −1 needle/cases.py
View
8 needle/cases.py
@@ -69,7 +69,13 @@ def assertScreenshot(self, element, name, threshold=0.1):
else:
image = Image.open(filename)
diff = ImageDiff(element.get_screenshot(), image)
- self.assertAlmostEqual(diff.get_distance(), 0, delta=threshold)
+ distance = abs(diff.get_distance())
+ if distance > threshold:
+ raise AssertionError("The saved screenshot for '%s' did not match "
+ "the screenshot captured (by a distance of %.2f)"
+ % (name, distance))
+
+
Please sign in to comment.
Something went wrong with that request. Please try again.