File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -457,8 +457,13 @@ def _image_directories(func):
457
457
``$(pwd)/result_images/test_baz``. The result directory is created if it
458
458
doesn't exist.
459
459
"""
460
- module_path = Path (inspect .getfile (func ))
461
- baseline_dir = module_path .parent / "baseline_images" / module_path .stem
462
- result_dir = Path ().resolve () / "result_images" / module_path .stem
460
+ mod = inspect .getmodule (func )
461
+ pkg_name , mod_name = mod .__name__ .rsplit ('.' , maxsplit = 1 )
462
+ if external_images := os .environ .get ("MPLTESTIMAGEPATH" , "" ):
463
+ file_base = Path (external_images ) / pkg_name .replace ('.' , os .path .sep )
464
+ else :
465
+ file_base = Path (inspect .getfile (func )).parent
466
+ baseline_dir = file_base / "baseline_images" / mod_name
467
+ result_dir = Path ().resolve () / "result_images" / mod_name
463
468
result_dir .mkdir (parents = True , exist_ok = True )
464
469
return baseline_dir , result_dir
You can’t perform that action at this time.
0 commit comments