Skip to content

Commit

Permalink
Do not log URL of test images if there is no URL
Browse files Browse the repository at this point in the history
  • Loading branch information
radarhere committed Jan 20, 2024
1 parent 9b6c1e3 commit f7701e6
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions Tests/helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,12 @@ def assert_image_equal(a: Image.Image, b: Image.Image, msg: str | None = None) -
assert a.mode == b.mode, msg or f"got mode {repr(a.mode)}, expected {repr(b.mode)}"
assert a.size == b.size, msg or f"got size {repr(a.size)}, expected {repr(b.size)}"
if a.tobytes() != b.tobytes():
if uploader:
try:
url = upload(a, b)
try:
url = upload(a, b)
if url:
logger.error("URL for test images: %s", url)
except Exception:
pass
except Exception:
pass

pytest.fail(msg or "got different content")

Expand Down Expand Up @@ -130,12 +130,12 @@ def assert_image_similar(
+ f" average pixel value difference {ave_diff:.4f} > epsilon {epsilon:.4f}"
)
except Exception as e:
if uploader:
try:
url = upload(a, b)
try:
url = upload(a, b)
if url:
logger.exception("URL for test images: %s", url)
except Exception:
pass
except Exception:
pass
raise e


Expand Down

0 comments on commit f7701e6

Please sign in to comment.