Skip to content

Commit 47e0c4b

Browse files
committed
found cases of 'import nose' , and also, use of
a decorator called 'knownfailureif' removed, and replaced with pytest versions if necessary.
1 parent 1e12273 commit 47e0c4b

21 files changed

+51
-79
lines changed

lib/matplotlib/testing/decorators.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
import warnings
1212
import unittest
1313

14-
import nose
1514
import numpy as np
1615

1716
import matplotlib as mpl

lib/matplotlib/tests/test_artist.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -206,8 +206,3 @@ def test_properties():
206206
warnings.simplefilter("always")
207207
ln.properties()
208208
assert len(w) == 0
209-
210-
211-
if __name__ == '__main__':
212-
import nose
213-
nose.runmodule(argv=['-s', '--with-doctest'], exit=False)

lib/matplotlib/tests/test_axes.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4367,10 +4367,9 @@ def test_pandas_indexing_hist():
43674367

43684368

43694369
if __name__ == '__main__':
4370-
import nose
43714370
import sys
43724371

4373-
args = ['-s', '--with-doctest']
4372+
args = ['--doctest-modules']
43744373
argv = sys.argv
43754374
argv = argv[:1] + args + argv[1:]
4376-
nose.runmodule(argv=argv, exit=False)
4375+
pytest.main(argv)

lib/matplotlib/tests/test_backend_pdf.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@
1212
from matplotlib import cm, rcParams
1313
from matplotlib.backends.backend_pdf import PdfPages
1414
from matplotlib import pyplot as plt
15-
from matplotlib.testing.decorators import (image_comparison, knownfailureif,
16-
cleanup)
15+
from matplotlib.testing.decorators import (image_comparison, cleanup)
1716

1817
if 'TRAVIS' not in os.environ:
1918
@image_comparison(baseline_images=['pdf_use14corefonts'],

lib/matplotlib/tests/test_backend_ps.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,18 @@
77
import re
88
import numpy as np
99
from matplotlib.externals import six
10-
10+
import pytest
1111
import matplotlib
1212
import matplotlib.pyplot as plt
1313
from matplotlib import patheffects
14-
from matplotlib.testing.decorators import cleanup, knownfailureif
14+
from matplotlib.testing.decorators import cleanup
1515

1616

17-
needs_ghostscript = knownfailureif(
17+
needs_ghostscript = pytest.mark.xfail(
1818
matplotlib.checkdep_ghostscript()[0] is None,
1919
"This test needs a ghostscript installation")
2020

21-
22-
needs_tex = knownfailureif(
21+
needs_tex = pytest.mark.xfail(
2322
not matplotlib.checkdep_tex(),
2423
"This test needs a TeX installation")
2524

lib/matplotlib/tests/test_backend_qt4.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
from matplotlib.externals.six import unichr
66
from matplotlib import pyplot as plt
77
from matplotlib.testing.decorators import cleanup, switch_backend
8-
from matplotlib.testing.decorators import knownfailureif
98
from matplotlib._pylab_helpers import Gcf
109
import matplotlib
1110
import copy
11+
import pytest
1212

1313
try:
1414
# mock in python 3.3+
@@ -40,7 +40,7 @@
4040

4141

4242
@cleanup
43-
@knownfailureif(not HAS_QT)
43+
@pytest.mark.xfail(not HAS_QT)
4444
@switch_backend('Qt4Agg')
4545
def test_fig_close():
4646
# save the state of Gcf.figs
@@ -81,87 +81,87 @@ def receive(event):
8181

8282

8383
@cleanup
84-
@knownfailureif(not HAS_QT)
84+
@pytest.mark.xfail(not HAS_QT)
8585
def test_shift():
8686
assert_correct_key(QtCore.Qt.Key_A,
8787
ShiftModifier,
8888
'A')
8989

9090

9191
@cleanup
92-
@knownfailureif(not HAS_QT)
92+
@pytest.mark.xfail(not HAS_QT)
9393
def test_lower():
9494
assert_correct_key(QtCore.Qt.Key_A,
9595
QtCore.Qt.NoModifier,
9696
'a')
9797

9898

9999
@cleanup
100-
@knownfailureif(not HAS_QT)
100+
@pytest.mark.xfail(not HAS_QT)
101101
def test_control():
102102
assert_correct_key(QtCore.Qt.Key_A,
103103
ControlModifier,
104104
'ctrl+a')
105105

106106

107107
@cleanup
108-
@knownfailureif(not HAS_QT)
108+
@pytest.mark.xfail(not HAS_QT)
109109
def test_unicode_upper():
110110
assert_correct_key(QtCore.Qt.Key_Aacute,
111111
ShiftModifier,
112112
unichr(193))
113113

114114

115115
@cleanup
116-
@knownfailureif(not HAS_QT)
116+
@pytest.mark.xfail(not HAS_QT)
117117
def test_unicode_lower():
118118
assert_correct_key(QtCore.Qt.Key_Aacute,
119119
QtCore.Qt.NoModifier,
120120
unichr(225))
121121

122122

123123
@cleanup
124-
@knownfailureif(not HAS_QT)
124+
@pytest.mark.xfail(not HAS_QT)
125125
def test_alt_control():
126126
assert_correct_key(ControlKey,
127127
AltModifier,
128128
'alt+control')
129129

130130

131131
@cleanup
132-
@knownfailureif(not HAS_QT)
132+
@pytest.mark.xfail(not HAS_QT)
133133
def test_control_alt():
134134
assert_correct_key(AltKey,
135135
ControlModifier,
136136
'ctrl+alt')
137137

138138

139139
@cleanup
140-
@knownfailureif(not HAS_QT)
140+
@pytest.mark.xfail(not HAS_QT)
141141
def test_modifier_order():
142142
assert_correct_key(QtCore.Qt.Key_Aacute,
143143
(ControlModifier | AltModifier | SuperModifier),
144144
'ctrl+alt+super+' + unichr(225))
145145

146146

147147
@cleanup
148-
@knownfailureif(not HAS_QT)
148+
@pytest.mark.xfail(not HAS_QT)
149149
def test_backspace():
150150
assert_correct_key(QtCore.Qt.Key_Backspace,
151151
QtCore.Qt.NoModifier,
152152
'backspace')
153153

154154

155155
@cleanup
156-
@knownfailureif(not HAS_QT)
156+
@pytest.mark.xfail(not HAS_QT)
157157
def test_backspace_mod():
158158
assert_correct_key(QtCore.Qt.Key_Backspace,
159159
ControlModifier,
160160
'ctrl+backspace')
161161

162162

163163
@cleanup
164-
@knownfailureif(not HAS_QT)
164+
@pytest.mark.xfail(not HAS_QT)
165165
def test_non_unicode_key():
166166
assert_correct_key(QtCore.Qt.Key_Play,
167167
QtCore.Qt.NoModifier,

lib/matplotlib/tests/test_backend_qt5.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44

55
from matplotlib import pyplot as plt
66
from matplotlib.testing.decorators import cleanup, switch_backend
7-
from matplotlib.testing.decorators import knownfailureif
87
from matplotlib._pylab_helpers import Gcf
98
import matplotlib
109
import copy
10+
import pytest
1111

1212
try:
1313
# mock in python 3.3+
@@ -34,7 +34,7 @@
3434

3535

3636
@cleanup
37-
@knownfailureif(not HAS_QT)
37+
@pytest.mark.xfail(not HAS_QT)
3838
@switch_backend('Qt5Agg')
3939
def test_fig_close():
4040
# save the state of Gcf.figs
@@ -75,87 +75,87 @@ def receive(event):
7575

7676

7777
@cleanup
78-
@knownfailureif(not HAS_QT)
78+
@pytest.mark.xfail(not HAS_QT)
7979
def test_shift():
8080
assert_correct_key(QtCore.Qt.Key_A,
8181
ShiftModifier,
8282
'A')
8383

8484

8585
@cleanup
86-
@knownfailureif(not HAS_QT)
86+
@pytest.mark.xfail(not HAS_QT)
8787
def test_lower():
8888
assert_correct_key(QtCore.Qt.Key_A,
8989
QtCore.Qt.NoModifier,
9090
'a')
9191

9292

9393
@cleanup
94-
@knownfailureif(not HAS_QT)
94+
@pytest.mark.xfail(not HAS_QT)
9595
def test_control():
9696
assert_correct_key(QtCore.Qt.Key_A,
9797
ControlModifier,
9898
'ctrl+a')
9999

100100

101101
@cleanup
102-
@knownfailureif(not HAS_QT)
102+
@pytest.mark.xfail(not HAS_QT)
103103
def test_unicode_upper():
104104
assert_correct_key(QtCore.Qt.Key_Aacute,
105105
ShiftModifier,
106106
six.unichr(193))
107107

108108

109109
@cleanup
110-
@knownfailureif(not HAS_QT)
110+
@pytest.mark.xfail(not HAS_QT)
111111
def test_unicode_lower():
112112
assert_correct_key(QtCore.Qt.Key_Aacute,
113113
QtCore.Qt.NoModifier,
114114
six.unichr(225))
115115

116116

117117
@cleanup
118-
@knownfailureif(not HAS_QT)
118+
@pytest.mark.xfail(not HAS_QT)
119119
def test_alt_control():
120120
assert_correct_key(ControlKey,
121121
AltModifier,
122122
'alt+control')
123123

124124

125125
@cleanup
126-
@knownfailureif(not HAS_QT)
126+
@pytest.mark.xfail(not HAS_QT)
127127
def test_control_alt():
128128
assert_correct_key(AltKey,
129129
ControlModifier,
130130
'ctrl+alt')
131131

132132

133133
@cleanup
134-
@knownfailureif(not HAS_QT)
134+
@pytest.mark.xfail(not HAS_QT)
135135
def test_modifier_order():
136136
assert_correct_key(QtCore.Qt.Key_Aacute,
137137
(ControlModifier | AltModifier | SuperModifier),
138138
'ctrl+alt+super+' + six.unichr(225))
139139

140140

141141
@cleanup
142-
@knownfailureif(not HAS_QT)
142+
@pytest.mark.xfail(not HAS_QT)
143143
def test_backspace():
144144
assert_correct_key(QtCore.Qt.Key_Backspace,
145145
QtCore.Qt.NoModifier,
146146
'backspace')
147147

148148

149149
@cleanup
150-
@knownfailureif(not HAS_QT)
150+
@pytest.mark.xfail(not HAS_QT)
151151
def test_backspace_mod():
152152
assert_correct_key(QtCore.Qt.Key_Backspace,
153153
ControlModifier,
154154
'ctrl+backspace')
155155

156156

157157
@cleanup
158-
@knownfailureif(not HAS_QT)
158+
@pytest.mark.xfail(not HAS_QT)
159159
def test_non_unicode_key():
160160
assert_correct_key(QtCore.Qt.Key_Play,
161161
QtCore.Qt.NoModifier,

lib/matplotlib/tests/test_backend_svg.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,3 @@ def test_determinism_tex():
183183
# unique filename to allow for parallel testing
184184
_test_determinism('determinism_tex.svg', usetex=True)
185185

186-
187-
if __name__ == '__main__':
188-
import nose
189-
nose.runmodule(argv=['-s', '--with-doctest'], exit=False)

lib/matplotlib/tests/test_basic.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@
33

44
from matplotlib.externals import six
55

6-
from nose.tools import assert_equal
76

8-
from matplotlib.testing.decorators import knownfailureif
97
from pylab import *
108
import pytest
119

lib/matplotlib/tests/test_collections.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -616,7 +616,3 @@ def test_size_in_xy():
616616
ax.set_xlim(0, 30)
617617
ax.set_ylim(0, 30)
618618

619-
620-
if __name__ == '__main__':
621-
import nose
622-
nose.runmodule(argv=['-s', '--with-doctest'], exit=False)

lib/matplotlib/tests/test_colors.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
import matplotlib.cbook as cbook
1616
import matplotlib.pyplot as plt
1717
from matplotlib.testing.decorators import (image_comparison,
18-
cleanup, knownfailureif)
18+
cleanup)
1919
import pytest
2020

2121

@@ -397,7 +397,7 @@ def test_light_source_shading_default():
397397
assert_array_almost_equal(rgb, expect, decimal=2)
398398

399399

400-
@knownfailureif((V(np.__version__) <= V('1.9.0')
400+
@pytest.mark.xfail((V(np.__version__) <= V('1.9.0')
401401
and V(np.__version__) >= V('1.7.0')))
402402
# Numpy 1.9.1 fixed a bug in masked arrays which resulted in
403403
# additional elements being masked when calculating the gradient thus

lib/matplotlib/tests/test_contour.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,3 @@ def test_vminvmax_warning():
310310
assert (str(w[0].message).startswith(
311311
("vmax is deprecated and will be removed in 2.2 ")))
312312

313-
314-
if __name__ == '__main__':
315-
import nose
316-
nose.runmodule(argv=['-s', '--with-doctest'], exit=False)

lib/matplotlib/tests/test_delaunay.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import warnings
99

1010
import numpy as np
11-
from matplotlib.testing.decorators import image_comparison, knownfailureif
11+
from matplotlib.testing.decorators import image_comparison
1212
from matplotlib.cbook import MatplotlibDeprecationWarning
1313

1414
with warnings.catch_warnings():

0 commit comments

Comments
 (0)