Skip to content

Commit

Permalink
Merge pull request #213 from eerovaher/no_legacypath
Browse files Browse the repository at this point in the history
  • Loading branch information
ConorMacBride committed Nov 22, 2023
2 parents bad8fb7 + eee62ee commit f27a86e
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions pytest_mpl/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
from urllib.request import urlopen

import pytest
from packaging.version import Version

from pytest_mpl.summary.html import generate_summary_basic_html, generate_summary_html

Expand All @@ -56,6 +57,8 @@
Actual shape: {actual_shape}
{actual_path}"""

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

# The following are the subsets of formats supported by the Matplotlib image
# comparison machinery
RASTER_IMAGE_FORMATS = ['png']
Expand All @@ -64,8 +67,8 @@


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
path = Path(item.fspath) if PYTEST_LT_7 else item.path
return path.parent


def _hash_file(in_stream):
Expand Down

0 comments on commit f27a86e

Please sign in to comment.