From 064e6ee85417ab312dcbceaa2d334dd6bf9e1f25 Mon Sep 17 00:00:00 2001 From: Elias <110238618+ESadek-MO@users.noreply.github.com> Date: Thu, 14 Sep 2023 15:07:54 +0100 Subject: [PATCH] idiff acceptance fix (#5482) * removed duplication case in Accept * updated docstring * corrected whatsnew (hopefully) * the merge undid the fix. Here we go * removed trailng . from whatsnew * changed ref to mod --- docs/src/whatsnew/latest.rst | 3 +++ lib/iris/tests/graphics/idiff.py | 17 ++++++----------- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/docs/src/whatsnew/latest.rst b/docs/src/whatsnew/latest.rst index 8391f2ced6..35b6121c41 100644 --- a/docs/src/whatsnew/latest.rst +++ b/docs/src/whatsnew/latest.rst @@ -38,6 +38,9 @@ This document explains the changes made to Iris for this release #. `@scottrobinson02`_ fixed the output units when dividing a coordinate by a cube. (:issue:`5305`, :pull:`5331`) + +#. `@ESadek-MO`_ has updated :mod:`iris.tests.graphics.idiff` to stop duplicated file names + preventing acceptance. (:issue:`5098`, :pull:`5482`) 💣 Incompatible Changes diff --git a/lib/iris/tests/graphics/idiff.py b/lib/iris/tests/graphics/idiff.py index a355f2cf82..62e72f4e0e 100755 --- a/lib/iris/tests/graphics/idiff.py +++ b/lib/iris/tests/graphics/idiff.py @@ -73,17 +73,12 @@ def diff_viewer( repo = graphics.read_repo_json() def accept(event): - if test_id not in repo: - repo[test_id] = phash - graphics.write_repo_json(repo) - out_file = result_dir / (test_id + ".png") - result_path.rename(out_file) - msg = f"ACCEPTED: {result_path.name} -> {out_file.name}" - print(msg) - else: - msg = f"DUPLICATE: {result_path.name} -> {expected_path.name} (ignored)" - print(msg) - result_path.unlink() + repo[test_id] = phash + graphics.write_repo_json(repo) + out_file = result_dir / (test_id + ".png") + result_path.rename(out_file) + msg = f"ACCEPTED: {result_path.name} -> {out_file.name}" + print(msg) diff_fname.unlink() plt.close()