@@ -675,7 +675,7 @@ def _ensure_folder(self, path):
675
675
logger .warning ('Creating folder: %s' , dir_path )
676
676
os .makedirs (dir_path )
677
677
678
- def _assert_graphic (self , tol = _HAMMING_DISTANCE ):
678
+ def check_graphic (self ):
679
679
"""
680
680
Check the hash of the current matplotlib figure matches the expected
681
681
image hash for the current graphic test.
@@ -734,7 +734,8 @@ def _create_missing():
734
734
figure .savefig (hash_fname )
735
735
msg = 'Creating imagerepo entry: {} -> {}'
736
736
print (msg .format (unique_id , uri ))
737
- lock = filelock .FileLock (repo_fname )
737
+ lock = filelock .FileLock (os .path .join (_RESULT_PATH ,
738
+ 'imagerepo.lock' ))
738
739
# The imagerepo.json file is a critical resource, so ensure
739
740
# thread safe read/write behaviour via platform independent
740
741
# file locking.
@@ -781,7 +782,7 @@ def _hex_to_hash(hexstr, hash_size=_HASH_SIZE):
781
782
# Calculate the hamming distance vector for the result hash.
782
783
distances = [e - phash for e in expected ]
783
784
784
- if np .all ([hd > tol for hd in distances ]):
785
+ if np .all ([hd > _HAMMING_DISTANCE for hd in distances ]):
785
786
if dev_mode :
786
787
_create_missing ()
787
788
else :
@@ -802,15 +803,6 @@ def _hex_to_hash(hexstr, hash_size=_HASH_SIZE):
802
803
finally :
803
804
plt .close ()
804
805
805
- def check_graphic (self ):
806
- """
807
- Checks that the image hash for the current matplotlib figure matches
808
- the expected image hash for the current test.
809
-
810
- """
811
- fname = os .path .join (_RESULT_PATH , 'imagerepo.lock' )
812
- self ._assert_graphic ()
813
-
814
806
def _remove_testcase_patches (self ):
815
807
"""Helper to remove per-testcase patches installed by :meth:`patch`."""
816
808
# Remove all patches made, ignoring errors.
0 commit comments