Skip to content

Commit f7701e6

Browse files
committed
Do not log URL of test images if there is no URL
1 parent 9b6c1e3 commit f7701e6

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

Diff for: Tests/helper.py

+10-10
Original file line numberDiff line numberDiff line change
@@ -91,12 +91,12 @@ def assert_image_equal(a: Image.Image, b: Image.Image, msg: str | None = None) -
9191
assert a.mode == b.mode, msg or f"got mode {repr(a.mode)}, expected {repr(b.mode)}"
9292
assert a.size == b.size, msg or f"got size {repr(a.size)}, expected {repr(b.size)}"
9393
if a.tobytes() != b.tobytes():
94-
if uploader:
95-
try:
96-
url = upload(a, b)
94+
try:
95+
url = upload(a, b)
96+
if url:
9797
logger.error("URL for test images: %s", url)
98-
except Exception:
99-
pass
98+
except Exception:
99+
pass
100100

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

@@ -130,12 +130,12 @@ def assert_image_similar(
130130
+ f" average pixel value difference {ave_diff:.4f} > epsilon {epsilon:.4f}"
131131
)
132132
except Exception as e:
133-
if uploader:
134-
try:
135-
url = upload(a, b)
133+
try:
134+
url = upload(a, b)
135+
if url:
136136
logger.exception("URL for test images: %s", url)
137-
except Exception:
138-
pass
137+
except Exception:
138+
pass
139139
raise e
140140

141141

0 commit comments

Comments
 (0)