10000 Backport PR #21905: Fix image testing decorator in pytest importlib mode · matplotlib/matplotlib@f3e15ff · GitHub
[go: up one dir, main page]

Skip to content

Commit f3e15ff

Browse files
jklymakmeeseeksmachine
authored andcommitted
Backport PR #21905: Fix image testing decorator in pytest importlib mode
1 parent b8a60b9 commit f3e15ff

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/matplotlib/testing/decorators.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -479,7 +479,7 @@ def _image_directories(func):
479479
``$(pwd)/result_images/test_baz``. The result directory is created if it
480480
doesn't exist.
481481
"""
482-
module_path = Path(sys.modules[func.__module__].__file__)
482+
module_path = Path(inspect.getfile(func))
483483
baseline_dir = module_path.parent / "baseline_images" / module_path.stem
484484
result_dir = Path().resolve() / "result_images" / module_path.stem
485485
result_dir.mkdir(parents=True, exist_ok=True)

0 commit comments

Comments
 (0)
0