Skip to content

Commit 78ab284

Browse files
authored
Merge pull request #54 from dopplershift/fix-deprecation
MNT: Avoid using deprecated remove_text
2 parents a38e478 + 4a1970d commit 78ab284

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

pytest_mpl/plugin.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,10 @@ def pytest_runtest_setup(self, item):
147147
import matplotlib.pyplot as plt
148148
from matplotlib.testing.compare import compare_images
149149
from matplotlib.testing.decorators import ImageComparisonTest as MplImageComparisonTest
150+
try:
151+
from matplotlib.testing.decorators import remove_ticks_and_titles
152+
except ImportError:
153+
remove_ticks_and_titles = MplImageComparisonTest.remove_text
150154

151155
MPL_LT_15 = LooseVersion(matplotlib.__version__) < LooseVersion('1.5')
152156

@@ -196,7 +200,7 @@ def item_function_wrapper(*args, **kwargs):
196200
fig = original(*args, **kwargs)
197201

198202
if remove_text:
199-
MplImageComparisonTest.remove_text(fig)
203+
remove_ticks_and_titles(fig)
200204

201205
# Find test name to use as plot name
202206
filename = compare.kwargs.get('filename', None)

0 commit comments

Comments
 (0)