Skip to content

Commit cf5cebe

Browse files
timhoffmmeeseeksmachine
authored andcommitted
Backport PR matplotlib#31906: TST: unpin pytest
1 parent 59b31a6 commit cf5cebe

8 files changed

Lines changed: 15 additions & 19 deletions

File tree

environment.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ dependencies:
6363
- psutil
6464
- prek
6565
- pydocstyle>=5.1.0
66-
- pytest!=4.6.0,!=5.4.0,!=8.1.0,<9.1.0
66+
- pytest!=4.6.0,!=5.4.0,!=8.1.0
6767
- pytest-cov
6868
- pytest-rerunfailures
6969
- pytest-timeout

lib/matplotlib/tests/test_animation.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ def gen_writers():
181181
# Smoke test for saving animations. In the future, we should probably
182182
# design more sophisticated tests which compare resulting frames a-la
183183
# matplotlib.testing.image_comparison
184-
@pytest.mark.parametrize('writer, frame_format, output', gen_writers())
184+
@pytest.mark.parametrize('writer, frame_format, output', list(gen_writers()))
185185
@pytest.mark.parametrize('anim', [dict(klass=dict)], indirect=['anim'])
186186
def test_save_animation_smoketest(tmp_path, writer, frame_format, output, anim):
187187
if frame_format is not None:
@@ -201,7 +201,7 @@ def test_save_animation_smoketest(tmp_path, writer, frame_format, output, anim):
201201
del anim
202202

203203

204-
@pytest.mark.parametrize('writer, frame_format, output', gen_writers())
204+
@pytest.mark.parametrize('writer, frame_format, output', list(gen_writers()))
205205
def test_grabframe(tmp_path, writer, frame_format, output):
206206
WriterClass = animation.writers[writer]
207207

lib/matplotlib/tests/test_mathtext.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ def baseline_images(request, fontset, index, text):
221221

222222

223223
@pytest.mark.parametrize(
224-
'index, text', enumerate(math_tests), ids=range(len(math_tests)))
224+
'index, text', list(enumerate(math_tests)), ids=range(len(math_tests)))
225225
@pytest.mark.parametrize(
226226
'fontset', ['cm', 'stix', 'stixsans', 'dejavusans', 'dejavuserif'])
227227
@pytest.mark.parametrize('baseline_images', ['mathtext'], indirect=True)
@@ -237,7 +237,7 @@ def test_mathtext_rendering(baseline_images, fontset, index, text):
237237
horizontalalignment='center', verticalalignment='center')
238238

239239

240-
@pytest.mark.parametrize('index, text', enumerate(svgastext_math_tests),
240+
@pytest.mark.parametrize('index, text', list(enumerate(svgastext_math_tests)),
241241
ids=range(len(svgastext_math_tests)))
242242
@pytest.mark.parametrize('fontset', ['cm', 'dejavusans'])
243243
@pytest.mark.parametrize('baseline_images', ['mathtext0'], indirect=True)
@@ -254,7 +254,7 @@ def test_mathtext_rendering_svgastext(baseline_images, fontset, index, text):
254254
horizontalalignment='center', verticalalignment='center')
255255

256256

257-
@pytest.mark.parametrize('index, text', enumerate(lightweight_math_tests),
257+
@pytest.mark.parametrize('index, text', list(enumerate(lightweight_math_tests)),
258258
ids=range(len(lightweight_math_tests)))
259259
@pytest.mark.parametrize('fontset', ['dejavusans'])
260260
@pytest.mark.parametrize('baseline_images', ['mathtext1'], indirect=True)
@@ -266,7 +266,7 @@ def test_mathtext_rendering_lightweight(baseline_images, fontset, index, text):
266266

267267

268268
@pytest.mark.parametrize(
269-
'index, text', enumerate(font_tests), ids=range(len(font_tests)))
269+
'index, text', list(enumerate(font_tests)), ids=range(len(font_tests)))
270270
@pytest.mark.parametrize(
271271
'fontset', ['cm', 'stix', 'stixsans', 'dejavusans', 'dejavuserif'])
272272
@pytest.mark.parametrize('baseline_images', ['mathfont'], indirect=True)

lib/matplotlib/tests/test_mlab.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,8 @@ def test_detrend_linear_2d(self):
207207
scope='class')
208208
class TestSpectral:
209209
@pytest.fixture(scope='class', autouse=True)
210-
def stim(self, request, fstims, iscomplex, sides, len_x, NFFT_density,
210+
@classmethod
211+
def stim(cls, request, fstims, iscomplex, sides, len_x, NFFT_density,
211212
nover_density, pad_to_density, pad_to_spectrum):
212213
Fs = 100.
213214

@@ -323,11 +324,6 @@ def stim(self, request, fstims, iscomplex, sides, len_x, NFFT_density,
323324
if iscomplex:
324325
y = y.astype('complex')
325326

326-
# Interestingly, the instance on which this fixture is called is not
327-
# the same as the one on which a test is run. So we need to modify the
328-
# class itself when using a class-scoped fixture.
329-
cls = request.cls
330-
331327
cls.Fs = Fs
332328
cls.sides = sides
333329
cls.fstims = fstims

lib/matplotlib/tests/test_path.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ def test_contains_points_negative_radius():
105105
(1., 2., 1., 2.)]
106106

107107

108-
@pytest.mark.parametrize('path, extents', zip(_test_paths, _test_path_extents))
108+
@pytest.mark.parametrize('path, extents', list(zip(_test_paths, _test_path_extents)))
109109
def test_exact_extents(path, extents):
110110
# notice that if we just looked at the control points to get the bounding
111111
# box of each curve, we would get the wrong answers. For example, for

lib/matplotlib/tests/test_rcparams.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,7 @@ def generate_validator_testcases(valid):
444444

445445

446446
@pytest.mark.parametrize('validator, arg, target',
447-
generate_validator_testcases(True))
447+
list(generate_validator_testcases(True)))
448448
def test_validator_valid(validator, arg, target):
449449
res = validator(arg)
450450
if isinstance(target, np.ndarray):
@@ -457,7 +457,7 @@ def test_validator_valid(validator, arg, target):
457457

458458

459459
@pytest.mark.parametrize('validator, arg, exception_type',
460-
generate_validator_testcases(False))
460+
list(generate_validator_testcases(False)))
461461
def test_validator_invalid(validator, arg, exception_type):
462462
with pytest.raises(exception_type):
463463
validator(arg)

lib/matplotlib/tests/test_ticker.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -461,7 +461,7 @@ class TestLogitLocator:
461461

462462
@pytest.mark.parametrize(
463463
"lims, expected_low_ticks",
464-
zip(ref_basic_limits, ref_basic_major_ticks),
464+
list(zip(ref_basic_limits, ref_basic_major_ticks)),
465465
)
466466
def test_basic_major(self, lims, expected_low_ticks):
467467
"""
@@ -506,7 +506,7 @@ def test_nbins_major(self, lims):
506506

507507
@pytest.mark.parametrize(
508508
"lims, expected_low_ticks",
509-
zip(ref_basic_limits, ref_basic_major_ticks),
509+
list(zip(ref_basic_limits, ref_basic_major_ticks)),
510510
)
511511
def test_minor(self, lims, expected_low_ticks):
512512
"""

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ test = [
130130
"certifi",
131131
"coverage!=6.3",
132132
"psutil; sys_platform != 'cygwin'",
133-
"pytest!=4.6.0,!=5.4.0,!=8.1.0,<9.1.0",
133+
"pytest!=4.6.0,!=5.4.0,!=8.1.0",
134134
"pytest-cov",
135135
"pytest-rerunfailures!=16.0",
136136
"pytest-timeout",

0 commit comments

Comments
 (0)