We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents bad8fb7 + eee62ee commit f27a86eCopy full SHA for f27a86e
pytest_mpl/plugin.py
@@ -41,6 +41,7 @@
41
from urllib.request import urlopen
42
43
import pytest
44
+from packaging.version import Version
45
46
from pytest_mpl.summary.html import generate_summary_basic_html, generate_summary_html
47
@@ -56,6 +57,8 @@
56
57
Actual shape: {actual_shape}
58
{actual_path}"""
59
60
+PYTEST_LT_7 = Version(pytest.__version__) < Version("7.0.0")
61
+
62
# The following are the subsets of formats supported by the Matplotlib image
63
# comparison machinery
64
RASTER_IMAGE_FORMATS = ['png']
@@ -64,8 +67,8 @@
67
65
68
66
69
def _get_item_dir(item):
- # .path is available starting from pytest 7, .fspath is for older versions.
- return getattr(item, "path", Path(item.fspath)).parent
70
+ path = Path(item.fspath) if PYTEST_LT_7 else item.path
71
+ return path.parent
72
73
74
def _hash_file(in_stream):
0 commit comments