diff --git a/Tests/test_file_apng.py b/Tests/test_file_apng.py index b9918c22db1..a79dabcc054 100644 --- a/Tests/test_file_apng.py +++ b/Tests/test_file_apng.py @@ -674,6 +674,8 @@ def test_save_all_progress() -> None: progress = [] def callback(state): + if state["image_filename"]: + state["image_filename"] = state["image_filename"].split("Tests/images/")[-1] progress.append(state) Image.new("RGB", (1, 1)).save(out, "PNG", save_all=True, progress=callback) @@ -700,7 +702,7 @@ def callback(state): expected.append( { "image_index": i, - "image_filename": "Tests/images/apng/single_frame.png", + "image_filename": "apng/single_frame.png", "completed_frames": i + 1, "total_frames": 7, } @@ -709,7 +711,7 @@ def callback(state): expected.append( { "image_index": 2, - "image_filename": "Tests/images/apng/delay.png", + "image_filename": "apng/delay.png", "completed_frames": i + 3, "total_frames": 7, } diff --git a/Tests/test_file_gif.py b/Tests/test_file_gif.py index 9ab843ec0b4..4a6844c2172 100644 --- a/Tests/test_file_gif.py +++ b/Tests/test_file_gif.py @@ -297,6 +297,8 @@ def test_save_all_progress(): progress = [] def callback(state): + if state["image_filename"]: + state["image_filename"] = state["image_filename"].split("Tests/images/")[-1] progress.append(state) Image.new("RGB", (1, 1)).save(out, "GIF", save_all=True, progress=callback) @@ -328,7 +330,7 @@ def callback(state): expected.append( { "image_index": 1, - "image_filename": "Tests/images/chi.gif", + "image_filename": "chi.gif", "completed_frames": i + 2, "total_frames": 32, } diff --git a/Tests/test_file_mpo.py b/Tests/test_file_mpo.py index f7e82addf37..845595eb2fd 100644 --- a/Tests/test_file_mpo.py +++ b/Tests/test_file_mpo.py @@ -288,6 +288,8 @@ def test_save_all_progress(): progress = [] def callback(state): + if state["image_filename"]: + state["image_filename"] = state["image_filename"].split("Tests/images/")[-1] progress.append(state) Image.new("RGB", (1, 1)).save(out, "MPO", save_all=True, progress=callback) @@ -308,9 +310,7 @@ def callback(state): im.save(out, "MPO", save_all=True, append_images=[im2], progress=callback) expected = [] - for i, filename in enumerate( - ["Tests/images/sugarshack.mpo", "Tests/images/frozenpond.mpo"] - ): + for i, filename in enumerate(["sugarshack.mpo", "frozenpond.mpo"]): for j in range(2): expected.append( { diff --git a/Tests/test_file_pdf.py b/Tests/test_file_pdf.py index 0b28760bee8..518ecffebf6 100644 --- a/Tests/test_file_pdf.py +++ b/Tests/test_file_pdf.py @@ -177,6 +177,8 @@ def test_save_all_progress() -> None: progress = [] def callback(state): + if state["image_filename"]: + state["image_filename"] = state["image_filename"].split("Tests/images/")[-1] progress.append(state) Image.new("RGB", (1, 1)).save(out, "PDF", save_all=True, progress=callback) @@ -197,9 +199,7 @@ def callback(state): im.save(out, "PDF", save_all=True, append_images=[im2], progress=callback) expected = [] - for i, filename in enumerate( - ["Tests/images/sugarshack.mpo", "Tests/images/frozenpond.mpo"] - ): + for i, filename in enumerate(["sugarshack.mpo", "frozenpond.mpo"]): for j in range(2): expected.append( { diff --git a/Tests/test_file_tiff.py b/Tests/test_file_tiff.py index a30c362e48f..147629d9a17 100644 --- a/Tests/test_file_tiff.py +++ b/Tests/test_file_tiff.py @@ -704,6 +704,10 @@ def test_save_all_progress(self) -> None: progress = [] def callback(state): + if state["image_filename"]: + state["image_filename"] = state["image_filename"].split( + "Tests/images/" + )[-1] progress.append(state) Image.new("RGB", (1, 1)).save(out, "TIFF", save_all=True, progress=callback) @@ -728,7 +732,7 @@ def callback(state): expected = [ { "image_index": 0, - "image_filename": "Tests/images/hopper.tif", + "image_filename": "hopper.tif", "completed_frames": 1, "total_frames": 4, } @@ -737,7 +741,7 @@ def callback(state): expected.append( { "image_index": 1, - "image_filename": "Tests/images/multipage.tiff", + "image_filename": "multipage.tiff", "completed_frames": i + 2, "total_frames": 4, } diff --git a/Tests/test_file_webp.py b/Tests/test_file_webp.py index 28317945106..c0050bddffd 100644 --- a/Tests/test_file_webp.py +++ b/Tests/test_file_webp.py @@ -131,6 +131,10 @@ def test_save_all_progress(self) -> None: progress = [] def callback(state): + if state["image_filename"]: + state["image_filename"] = state["image_filename"].split( + "Tests/images/" + )[-1] progress.append(state) Image.new("RGB", (1, 1)).save(out, "WEBP", save_all=True, progress=callback) @@ -155,7 +159,7 @@ def callback(state): expected.append( { "image_index": 0, - "image_filename": "Tests/images/iss634.webp", + "image_filename": "iss634.webp", "completed_frames": i + 1, "total_frames": 43, }