Skip to content

Commit

Permalink
compare_screenshots: Don't fail removing intermediate images if they …
Browse files Browse the repository at this point in the history
…don't exist
  • Loading branch information
mnoorenberghe committed Jan 16, 2017
1 parent 45ab5e4 commit 3029a78
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions mozscreenshots/compare_screenshots.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ def compare_images(before, after, outdir, similar_dir, args):
diff = -1
try:
diff = subprocess.check_output(["compare", "-quiet", "-fuzz", "3%", "-metric", "AE",
before_trimmed, after_trimmed, "null:"],
stderr=subprocess.STDOUT)
before_trimmed, after_trimmed, "null:"],
stderr=subprocess.STDOUT)
except OSError:
print("\n\nEnsure that ImageMagick is installed and on your PATH, specifically `compare`.\n")
raise
Expand Down Expand Up @@ -89,9 +89,9 @@ def compare_images(before, after, outdir, similar_dir, args):
print("error")

# Cleanup intermediate trimmed images
if os.path.abspath(before) != os.path.abspath(before_trimmed):
if os.path.exists(before_trimmed) and os.path.abspath(before) != os.path.abspath(before_trimmed):
os.remove(before_trimmed)
if os.path.abspath(after) != os.path.abspath(after_trimmed):
if os.path.exists(after_trimmed) and os.path.abspath(after) != os.path.abspath(after_trimmed):
os.remove(after_trimmed)
return (result, diff)

Expand Down

0 comments on commit 3029a78

Please sign in to comment.