diff --git a/lib/iris/tests/graphics/__init__.py b/lib/iris/tests/graphics/__init__.py index 2ef635128e..a083de3934 100755 --- a/lib/iris/tests/graphics/__init__.py +++ b/lib/iris/tests/graphics/__init__.py @@ -57,9 +57,9 @@ _lock = threading.Lock() #: Default perceptual hash size. -_HASH_SIZE = 16 +HASH_SIZE = 16 #: Default maximum perceptual hash hamming distance. -_HAMMING_DISTANCE = 2 +HAMMING_DISTANCE = 2 # Prefix for image test results (that aren't yet verified as good to add to # reference images) RESULT_PREFIX = "result-" @@ -135,7 +135,7 @@ def get_phash(input: Path) -> str: from PIL import Image import imagehash - return imagehash.phash(Image.open(input), hash_size=_HASH_SIZE) + return imagehash.phash(Image.open(input), hash_size=HASH_SIZE) def generate_repo_from_baselines(baseline_image_dir: Path) -> Dict[str, str]: @@ -220,7 +220,7 @@ def _create_missing(phash: str) -> None: # Calculate hamming distance vector for the result hash. distance = expected - phash - if distance > _HAMMING_DISTANCE: + if distance > HAMMING_DISTANCE: if dev_mode: _create_missing(phash) else: diff --git a/lib/iris/tests/graphics/recreate_imagerepo.py b/lib/iris/tests/graphics/recreate_imagerepo.py index 756e48688d..02ddaad2cb 100755 --- a/lib/iris/tests/graphics/recreate_imagerepo.py +++ b/lib/iris/tests/graphics/recreate_imagerepo.py @@ -29,9 +29,9 @@ def update_json(baseline_image_dir: Path, dry_run: bool = False): ) print(msg) else: - for key in set(repo.keys()) | set(suggested_repo.keys()): - old_val = repo.get(key, None) - new_val = suggested_repo.get(key, None) + for key in sorted(set(repo.keys()) | set(suggested_repo.keys())): + old_val = repo.get(key) + new_val = suggested_repo.get(key) if old_val is None: repo[key] = suggested_repo[key] print(key)