Skip to content

Commit 54a04c5

Browse files
committed
WIP: add a ENV to look for the baseline images out-of-tree
1 parent 803b4c8 commit 54a04c5

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

lib/matplotlib/testing/decorators.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -457,8 +457,13 @@ def _image_directories(func):
457457
``$(pwd)/result_images/test_baz``. The result directory is created if it
458458
doesn't exist.
459459
"""
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
463468
result_dir.mkdir(parents=True, exist_ok=True)
464469
return baseline_dir, result_dir

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy