Skip to content

Commit

Permalink
Merge pull request #2567 from megies/compare_image_exceptions
Browse files Browse the repository at this point in the history
more informative exceptions for empty/not-existing images in compare_images()
  • Loading branch information
tacaswell committed Nov 23, 2013
2 parents f8687b0 + f3fa220 commit 5b082a5
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lib/matplotlib/testing/compare.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,13 @@ def compare_images( expected, actual, tol, in_decorator=False ):
- in_decorator If called from image_comparison decorator, this should be
True. (default=False)
'''
if not os.path.exists(actual):
msg = "Output image %s does not exist." % actual
raise Exception(msg)

if os.stat(actual).st_size == 0:
msg = "Output image file %s is empty." % actual
raise Exception(msg)

verify(actual)

Expand Down

0 comments on commit 5b082a5

Please sign in to comment.