Skip to content

Commit 11d1e29

Browse files
committed
TMP: See if changing this breaks things
1 parent d813a2a commit 11d1e29

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

Diff for: pytest_mpl/plugin.py

+8-2
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
from pathlib import Path
4141
from urllib.request import urlopen
4242

43+
import pluggy
4344
import pytest
4445
from packaging.version import Version
4546

@@ -59,6 +60,11 @@
5960

6061
PYTEST_LT_7 = Version(pytest.__version__) < Version("7.0.0")
6162

63+
if Version(pluggy.__version__) >= Version("1.1.0"):
64+
HOOKIMPL_KWARGS = {"wrapper": True} # preferred for pluggy >= 1.1
65+
else:
66+
HOOKIMPL_KWARGS = {"hookwrapper": True}
67+
6268
# The following are the subsets of formats supported by the Matplotlib image
6369
# comparison machinery
6470
RASTER_IMAGE_FORMATS = ['png']
@@ -759,7 +765,7 @@ def compare_image_to_hash_library(self, item, fig, result_dir, summary=None):
759765
return
760766
return summary['status_msg']
761767

762-
@pytest.hookimpl(hookwrapper=True)
768+
@pytest.hookimpl(**HOOKIMPL_KWARGS)
763769
def pytest_runtest_call(self, item): # noqa
764770

765771
compare = get_compare(item)
@@ -918,7 +924,7 @@ def __init__(self, config):
918924
self.config = config
919925
self.return_value = {}
920926

921-
@pytest.hookimpl(hookwrapper=True)
927+
@pytest.hookimpl(**HOOKIMPL_KWARGS)
922928
def pytest_runtest_call(self, item):
923929
wrap_figure_interceptor(self, item)
924930
yield

0 commit comments

Comments
 (0)