Skip to content

Commit

Permalink
idiff acceptance fix (#5482)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
ESadek-MO authored Sep 14, 2023
1 parent c53481e commit 064e6ee
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
3 changes: 3 additions & 0 deletions docs/src/whatsnew/latest.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
17 changes: 6 additions & 11 deletions lib/iris/tests/graphics/idiff.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down

0 comments on commit 064e6ee

Please sign in to comment.