From c1b430b96800e7ef152c561782e660d09a881ba3 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Thu, 9 Dec 2021 23:59:25 -0500 Subject: [PATCH] Fix image testing decorator in pytest importlib mode In importlib mode, files are not added to `sys.modules`, so we cannot use that to find the file path. Fixes #21885 --- lib/matplotlib/testing/decorators.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/matplotlib/testing/decorators.py b/lib/matplotlib/testing/decorators.py index 562cb4f43567..d9285d9befae 100644 --- a/lib/matplotlib/testing/decorators.py +++ b/lib/matplotlib/testing/decorators.py @@ -502,7 +502,7 @@ def _image_directories(func): ``$(pwd)/result_images/test_baz``. The result directory is created if it doesn't exist. """ - module_path = Path(sys.modules[func.__module__].__file__) + module_path = Path(inspect.getfile(func)) baseline_dir = module_path.parent / "baseline_images" / module_path.stem result_dir = Path().resolve() / "result_images" / module_path.stem result_dir.mkdir(parents=True, exist_ok=True) 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