8000 Remove nose/pytest compatibility functions. · matplotlib/matplotlib@481c826 · GitHub
[go: up one dir, main page]

Skip to content

Commit 481c826

Browse files
committed
Remove nose/pytest compatibility functions.
They've never been released and are no longer used.
1 parent ca4d87a commit 481c826

File tree

7 files changed

+13
-38
lines changed

7 files changed

+13
-38
lines changed

lib/matplotlib/testing/__init__.py

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -20,28 +20,6 @@ def is_called_from_pytest():
2020
return getattr(matplotlib, '_called_from_pytest', False)
2121

2222

23-
def xfail(msg=""):
24-
"""Explicitly fail an currently-executing test with the given message."""
25-
__tracebackhide__ = True
26-
if is_called_from_pytest():
27-
import pytest
28-
pytest.xfail(msg)
29-
else:
30-
from .nose import knownfail
31-
knownfail(msg)
32-
33-
34-
def skip(msg=""):
35-
"""Skip an executing test with the given message."""
36-
__tracebackhide__ = True
37-
if is_called_from_pytest():
38-
import pytest
39-
pytest.skip(msg)
40-
else:
41-
from nose import SkipTest
42-
raise SkipTest(msg)
43-
44-
4523
# stolen from pytest
4624
def getrawcode(obj, trycall=True):
4725
"""Return code object for given function."""

lib/matplotlib/testing/_nose/decorators.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import os
55
import six
66
import sys
7-
from .. import copy_metadata, skip
7+
from .. import copy_metadata
88
from . import knownfail
99
from .exceptions import KnownFailureDidNotFailTest
1010

lib/matplotlib/testing/decorators.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
from matplotlib import ft2font
2727
from matplotlib.testing.compare import comparable_formats, compare_images, \
2828
make_test_filename
29-
from . import copy_metadata, is_called_from_pytest, xfail
29+
from . import copy_metadata, is_called_from_pytest
3030
from .exceptions import ImageComparisonFailure
3131

3232

@@ -270,9 +270,10 @@ def copy_baseline(self, baseline, extension):
270270
if os.path.exists(orig_expected_fname):
271271
shutil.copyfile(orig_expected_fname, expected_fname)
272272
else:
273-
xfail("Do not have baseline image {0} because this "
274-
"file does not exist: {1}".format(expected_fname,
275-
orig_expected_fname))
273+
from .nose import knownfail
274+
knownfail("Do not have baseline image {0} because this "
275+
"file does not exist: {1}".format(expected_fname,
276+
orig_expected_fname))
276277
return expected_fname
277278

8000
278279
def compare(self, idx, baseline, extension):

lib/matplotlib/tests/test_agg.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
from matplotlib.image import imread
1212
from matplotlib.backends.backend_agg import FigureCanvasAgg as FigureCanvas
1313
from matplotlib.figure import Figure
14-
from matplotlib.testing import skip
1514
from matplotlib.testing.decorators import cleanup, image_comparison
1615
from matplotlib import pyplot as plt
1716
from matplotlib import collections
@@ -181,7 +180,7 @@ def process_image(self, padded_src, dpi):
181180
return t2
182181

183182
if LooseVersion(np.__version__) < LooseVersion('1.7.0'):
184-
skip('Disabled on Numpy < 1.7.0')
183+
pytest.skip('Disabled on Numpy < 1.7.0')
185184

186185
fig = plt< 6D40 /span>.figure()
187186
ax = fig.add_subplot(111)

lib/matplotlib/tests/test_animation.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
import matplotlib as mpl
1414
from matplotlib import pyplot as plt
1515
from matplotlib import animation
16-
from matplotlib.testing import xfail, skip
1716
from matplotlib.testing.decorators import cleanup
1817

1918

@@ -121,7 +120,7 @@ def test_save_animation_smoketest(tmpdir, writer, extension):
121120
except AttributeError:
122121
pass
123122
if not animation.writers.is_available(writer):
124-
skip("writer '%s' not available on this system" % writer)
123+
pytest.skip("writer '%s' not available on this system" % writer)
125124
fig, ax = plt.subplots()
126125
line, = ax.plot([], [])
127126

@@ -145,8 +144,8 @@ def animate(i):
145144
try:
146145
anim.save('movie.' + extension, fps=30, writer=writer, bitrate=500)
147146
except UnicodeDecodeError:
148-
xfail("There can be errors in the numpy import stack, "
149-
"see issues #1891 and #2679")
147+
pytest.xfail("There can be errors in the numpy import stack, "
148+
"see issues #1891 and #2679")
150149

151150

152151
@cleanup

lib/matplotlib/tests/test_axes.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121

2222
import matplotlib
2323
from matplotlib.testing.decorators import image_comparison, cleanup
24-
from matplotlib.testing import skip
2524
import matplotlib.pyplot as plt
2625
import matplotlib.markers as mmarkers
2726
import matplotlib.patches as mpatches
@@ -90,7 +89,7 @@ def test_formatter_ticker():
9089
def test_formatter_large_small():
9190
# github issue #617, pull #619
9291
if LooseVersion(np.__version__) >= LooseVersion('1.11.0'):
93-
skip("Fall out from a fixed numpy bug")
92+
pytest.skip("Fall out from a fixed numpy bug")
9493
fig, ax = plt.subplots(1)
9594
x = [0.500000001, 0.500000002]
9695
y = [1e64, 1.1e64]

lib/matplotlib/tests/test_coding_standards.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
import os
66

77
import pytest
8-
from ..testing import xfail
98

109
try:
1110
import pep8
@@ -249,8 +248,8 @@ def test_pep8_conformance_examples():
249248
fp, tail = os.path.split(fp)
250249

251250
if mpldir is None:
252-
xfail("can not find the examples, set env MPL_REPO_DIR to point "
253-
"to the top-level path of the source tree")
251+
pytest.xfail("can not find the examples, set env MPL_REPO_DIR to "
252+
"point to the top-level path of the source tree")
254253

255254
exdir = os.path.join(mpldir, 'examples')
256255
blacklist = ()

0 commit comments

Comments
 (0)
0