From cbaed26deb86e2233c722c87186dc2473cd9264f Mon Sep 17 00:00:00 2001 From: Wei Ji Date: Fri, 11 Sep 2020 14:54:17 +1200 Subject: [PATCH] Fix doctest failures on helpers/testing.py --- pygmt/helpers/testing.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/pygmt/helpers/testing.py b/pygmt/helpers/testing.py index 1eb654cc6e4..9cf2167f1db 100644 --- a/pygmt/helpers/testing.py +++ b/pygmt/helpers/testing.py @@ -79,13 +79,16 @@ def decorator(func): old_sig = inspect.signature(func) @pytest.mark.parametrize("ext", extensions) - def wrapper(*args, ext, request, **kwargs): + def wrapper(*args, ext="png", request=None, **kwargs): if "ext" in old_sig.parameters: kwargs["ext"] = ext if "request" in old_sig.parameters: kwargs["request"] = request - - file_name = "".join(c for c in request.node.name if c in ALLOWED_CHARS) + try: + file_name = "".join(c for c in request.node.name if c in ALLOWED_CHARS) + except AttributeError: #'NoneType' object has no attribute 'node' + raise + file_name = func.__name__ try: fig_ref, fig_test = func(*args, **kwargs) ref_image_path = os.path.join(result_dir, f"{file_name}-expected.{ext}")