diff --git a/environment.yml b/environment.yml index 0266ac2b52e2..ed9cc7009541 100644 --- a/environment.yml +++ b/environment.yml @@ -63,7 +63,7 @@ dependencies: - psutil - prek - pydocstyle>=5.1.0 - - pytest!=4.6.0,!=5.4.0,!=8.1.0,<9.1.0 + - pytest!=4.6.0,!=5.4.0,!=8.1.0 - pytest-cov - pytest-rerunfailures - pytest-timeout diff --git a/lib/matplotlib/tests/test_animation.py b/lib/matplotlib/tests/test_animation.py index a00adcdf95f0..bfddddf6d665 100644 --- a/lib/matplotlib/tests/test_animation.py +++ b/lib/matplotlib/tests/test_animation.py @@ -181,7 +181,7 @@ def gen_writers(): # Smoke test for saving animations. In the future, we should probably # design more sophisticated tests which compare resulting frames a-la # matplotlib.testing.image_comparison -@pytest.mark.parametrize('writer, frame_format, output', gen_writers()) +@pytest.mark.parametrize('writer, frame_format, output', list(gen_writers())) @pytest.mark.parametrize('anim', [dict(klass=dict)], indirect=['anim']) def test_save_animation_smoketest(tmp_path, writer, frame_format, output, anim): if frame_format is not None: @@ -201,7 +201,7 @@ def test_save_animation_smoketest(tmp_path, writer, frame_format, output, anim): del anim -@pytest.mark.parametrize('writer, frame_format, output', gen_writers()) +@pytest.mark.parametrize('writer, frame_format, output', list(gen_writers())) def test_grabframe(tmp_path, writer, frame_format, output): WriterClass = animation.writers[writer] diff --git a/lib/matplotlib/tests/test_mathtext.py b/lib/matplotlib/tests/test_mathtext.py index a8f9236b5208..b200c3a9e048 100644 --- a/lib/matplotlib/tests/test_mathtext.py +++ b/lib/matplotlib/tests/test_mathtext.py @@ -221,7 +221,7 @@ def baseline_images(request, fontset, index, text): @pytest.mark.parametrize( - 'index, text', enumerate(math_tests), ids=range(len(math_tests))) + 'index, text', list(enumerate(math_tests)), ids=range(len(math_tests))) @pytest.mark.parametrize( 'fontset', ['cm', 'stix', 'stixsans', 'dejavusans', 'dejavuserif']) @pytest.mark.parametrize('baseline_images', ['mathtext'], indirect=True) @@ -237,7 +237,7 @@ def test_mathtext_rendering(baseline_images, fontset, index, text): horizontalalignment='center', verticalalignment='center') -@pytest.mark.parametrize('index, text', enumerate(svgastext_math_tests), +@pytest.mark.parametrize('index, text', list(enumerate(svgastext_math_tests)), ids=range(len(svgastext_math_tests))) @pytest.mark.parametrize('fontset', ['cm', 'dejavusans']) @pytest.mark.parametrize('baseline_images', ['mathtext0'], indirect=True) @@ -254,7 +254,7 @@ def test_mathtext_rendering_svgastext(baseline_images, fontset, index, text): horizontalalignment='center', verticalalignment='center') -@pytest.mark.parametrize('index, text', enumerate(lightweight_math_tests), +@pytest.mark.parametrize('index, text', list(enumerate(lightweight_math_tests)), ids=range(len(lightweight_math_tests))) @pytest.mark.parametrize('fontset', ['dejavusans']) @pytest.mark.parametrize('baseline_images', ['mathtext1'], indirect=True) @@ -266,7 +266,7 @@ def test_mathtext_rendering_lightweight(baseline_images, fontset, index, text): @pytest.mark.parametrize( - 'index, text', enumerate(font_tests), ids=range(len(font_tests))) + 'index, text', list(enumerate(font_tests)), ids=range(len(font_tests))) @pytest.mark.parametrize( 'fontset', ['cm', 'stix', 'stixsans', 'dejavusans', 'dejavuserif']) @pytest.mark.parametrize('baseline_images', ['mathfont'], indirect=True) diff --git a/lib/matplotlib/tests/test_mlab.py b/lib/matplotlib/tests/test_mlab.py index 82f877b4cc01..4f2ae49f4772 100644 --- a/lib/matplotlib/tests/test_mlab.py +++ b/lib/matplotlib/tests/test_mlab.py @@ -207,7 +207,8 @@ def test_detrend_linear_2d(self): scope='class') class TestSpectral: @pytest.fixture(scope='class', autouse=True) - def stim(self, request, fstims, iscomplex, sides, len_x, NFFT_density, + @classmethod + def stim(cls, request, fstims, iscomplex, sides, len_x, NFFT_density, nover_density, pad_to_density, pad_to_spectrum): Fs = 100. @@ -323,11 +324,6 @@ def stim(self, request, fstims, iscomplex, sides, len_x, NFFT_density, if iscomplex: y = y.astype('complex') - # Interestingly, the instance on which this fixture is called is not - # the same as the one on which a test is run. So we need to modify the - # class itself when using a class-scoped fixture. - cls = request.cls - cls.Fs = Fs cls.sides = sides cls.fstims = fstims diff --git a/lib/matplotlib/tests/test_path.py b/lib/matplotlib/tests/test_path.py index 3c7ad5e2f99b..c31f33647879 100644 --- a/lib/matplotlib/tests/test_path.py +++ b/lib/matplotlib/tests/test_path.py @@ -105,7 +105,7 @@ def test_contains_points_negative_radius(): (1., 2., 1., 2.)] -@pytest.mark.parametrize('path, extents', zip(_test_paths, _test_path_extents)) +@pytest.mark.parametrize('path, extents', list(zip(_test_paths, _test_path_extents))) def test_exact_extents(path, extents): # notice that if we just looked at the control points to get the bounding # box of each curve, we would get the wrong answers. For example, for diff --git a/lib/matplotlib/tests/test_rcparams.py b/lib/matplotlib/tests/test_rcparams.py index dc36392ab676..e740d2454125 100644 --- a/lib/matplotlib/tests/test_rcparams.py +++ b/lib/matplotlib/tests/test_rcparams.py @@ -444,7 +444,7 @@ def generate_validator_testcases(valid): @pytest.mark.parametrize('validator, arg, target', - generate_validator_testcases(True)) + list(generate_validator_testcases(True))) def test_validator_valid(validator, arg, target): res = validator(arg) if isinstance(target, np.ndarray): @@ -457,7 +457,7 @@ def test_validator_valid(validator, arg, target): @pytest.mark.parametrize('validator, arg, exception_type', - generate_validator_testcases(False)) + list(generate_validator_testcases(False))) def test_validator_invalid(validator, arg, exception_type): with pytest.raises(exception_type): validator(arg) diff --git a/lib/matplotlib/tests/test_ticker.py b/lib/matplotlib/tests/test_ticker.py index 0d01677acc8c..7930a05ff497 100644 --- a/lib/matplotlib/tests/test_ticker.py +++ b/lib/matplotlib/tests/test_ticker.py @@ -461,7 +461,7 @@ class TestLogitLocator: @pytest.mark.parametrize( "lims, expected_low_ticks", - zip(ref_basic_limits, ref_basic_major_ticks), + list(zip(ref_basic_limits, ref_basic_major_ticks)), ) def test_basic_major(self, lims, expected_low_ticks): """ @@ -506,7 +506,7 @@ def test_nbins_major(self, lims): @pytest.mark.parametrize( "lims, expected_low_ticks", - zip(ref_basic_limits, ref_basic_major_ticks), + list(zip(ref_basic_limits, ref_basic_major_ticks)), ) def test_minor(self, lims, expected_low_ticks): """ diff --git a/pyproject.toml b/pyproject.toml index 49457323cbec..02e2cf3b6734 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -130,7 +130,7 @@ test = [ "certifi", "coverage!=6.3", "psutil; sys_platform != 'cygwin'", - "pytest!=4.6.0,!=5.4.0,!=8.1.0,<9.1.0", + "pytest!=4.6.0,!=5.4.0,!=8.1.0", "pytest-cov", "pytest-rerunfailures!=16.0", "pytest-timeout",