diff options
| author | Chih-Hsuan Yen <yan12125@gmail.com> | 2020-12-13 18:01:50 +0800 |
|---|---|---|
| committer | Chih-Hsuan Yen <yan12125@gmail.com> | 2020-12-13 18:27:23 +0800 |
| commit | 701eee9e53dcbfe200bef46420da420052699e68 (patch) | |
| tree | 57dcd5a8b082014dd8e0b42ac3fa60f120a7b1da /setuptools | |
| parent | d368be2b5be8676ba8a3d55045b45b55090f6982 (diff) | |
| download | python-setuptools-git-701eee9e53dcbfe200bef46420da420052699e68.tar.gz | |
Fix tests with pytest 6.2
The latest pytest deprecates pytest.yield_fixture in favor of
pytest.fixture [1]. The changelog [2] says that both are the same.
[1] https://github.com/pytest-dev/pytest/pull/7988
[2] https://docs.pytest.org/en/stable/changelog.html#pytest-6-2-0-2020-12-12
Diffstat (limited to 'setuptools')
| -rw-r--r-- | setuptools/tests/fixtures.py | 4 | ||||
| -rw-r--r-- | setuptools/tests/test_develop.py | 4 | ||||
| -rw-r--r-- | setuptools/tests/test_easy_install.py | 6 | ||||
| -rw-r--r-- | setuptools/tests/test_egg_info.py | 2 | ||||
| -rw-r--r-- | setuptools/tests/test_msvc.py | 6 | ||||
| -rw-r--r-- | setuptools/tests/test_virtualenv.py | 3 |
6 files changed, 12 insertions, 13 deletions
diff --git a/setuptools/tests/fixtures.py b/setuptools/tests/fixtures.py index 5204c8d1..e8cb7f52 100644 --- a/setuptools/tests/fixtures.py +++ b/setuptools/tests/fixtures.py @@ -3,7 +3,7 @@ import pytest from . import contexts -@pytest.yield_fixture +@pytest.fixture def user_override(monkeypatch): """ Override site.USER_BASE and site.USER_SITE with temporary directories in @@ -17,7 +17,7 @@ def user_override(monkeypatch): yield -@pytest.yield_fixture +@pytest.fixture def tmpdir_cwd(tmpdir): with tmpdir.as_cwd() as orig: yield orig diff --git a/setuptools/tests/test_develop.py b/setuptools/tests/test_develop.py index 9854420e..2766da2f 100644 --- a/setuptools/tests/test_develop.py +++ b/setuptools/tests/test_develop.py @@ -31,7 +31,7 @@ INIT_PY = """print "foo" """ -@pytest.yield_fixture +@pytest.fixture def temp_user(monkeypatch): with contexts.tempdir() as user_base: with contexts.tempdir() as user_site: @@ -40,7 +40,7 @@ def temp_user(monkeypatch): yield -@pytest.yield_fixture +@pytest.fixture def test_env(tmpdir, temp_user): target = tmpdir foo = target.mkdir('foo') diff --git a/setuptools/tests/test_easy_install.py b/setuptools/tests/test_easy_install.py index 26a5e9a6..dc00e697 100644 --- a/setuptools/tests/test_easy_install.py +++ b/setuptools/tests/test_easy_install.py @@ -305,7 +305,7 @@ class TestPTHFileWriter: assert not pth.dirty -@pytest.yield_fixture +@pytest.fixture def setup_context(tmpdir): with (tmpdir / 'setup.py').open('w') as f: f.write(SETUP_PY) @@ -361,7 +361,7 @@ class TestUserInstallTest: f.write('Name: foo\n') return str(tmpdir) - @pytest.yield_fixture() + @pytest.fixture() def install_target(self, tmpdir): target = str(tmpdir) with mock.patch('sys.path', sys.path + [target]): @@ -406,7 +406,7 @@ class TestUserInstallTest: ) -@pytest.yield_fixture +@pytest.fixture def distutils_package(): distutils_setup_py = SETUP_PY.replace( 'from setuptools import setup', diff --git a/setuptools/tests/test_egg_info.py b/setuptools/tests/test_egg_info.py index dc472af4..1047468b 100644 --- a/setuptools/tests/test_egg_info.py +++ b/setuptools/tests/test_egg_info.py @@ -45,7 +45,7 @@ class TestEggInfo: """) }) - @pytest.yield_fixture + @pytest.fixture def env(self): with contexts.tempdir(prefix='setuptools-test.') as env_dir: env = Environment(env_dir) diff --git a/setuptools/tests/test_msvc.py b/setuptools/tests/test_msvc.py index 24e38ea8..d1527bfa 100644 --- a/setuptools/tests/test_msvc.py +++ b/setuptools/tests/test_msvc.py @@ -88,7 +88,7 @@ class TestModulePatch: assert isinstance(exc, expected) assert 'aka.ms/vcpython27' in str(exc) - @pytest.yield_fixture + @pytest.fixture def user_preferred_setting(self): """ Set up environment with different install dirs for user vs. system @@ -116,7 +116,7 @@ class TestModulePatch: expected = os.path.join(user_preferred_setting, 'vcvarsall.bat') assert expected == result - @pytest.yield_fixture + @pytest.fixture def local_machine_setting(self): """ Set up environment with only the system environment configured. @@ -138,7 +138,7 @@ class TestModulePatch: expected = os.path.join(local_machine_setting, 'vcvarsall.bat') assert expected == result - @pytest.yield_fixture + @pytest.fixture def x64_preferred_setting(self): """ Set up environment with 64-bit and 32-bit system settings configured diff --git a/setuptools/tests/test_virtualenv.py b/setuptools/tests/test_virtualenv.py index e7b100fb..21dea5bb 100644 --- a/setuptools/tests/test_virtualenv.py +++ b/setuptools/tests/test_virtualenv.py @@ -5,7 +5,6 @@ import sys import pathlib import pytest -from pytest import yield_fixture from pytest_fixture_config import yield_requires_config import pytest_virtualenv @@ -29,7 +28,7 @@ def pytest_virtualenv_works(virtualenv): @yield_requires_config(pytest_virtualenv.CONFIG, ['virtualenv_executable']) -@yield_fixture(scope='function') +@pytest.fixture(scope='function') def bare_virtualenv(): """ Bare virtualenv (no pip/setuptools/wheel). """ |
