Skip to content

Commit

Permalink
Ignore deprecated PT004 and PT005
Browse files Browse the repository at this point in the history
  • Loading branch information
Avasam committed Aug 16, 2024
1 parent 325dd4b commit 18042fb
Show file tree
Hide file tree
Showing 9 changed files with 19 additions and 17 deletions.
2 changes: 1 addition & 1 deletion pkg_resources/tests/test_resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -778,7 +778,7 @@ def symlinked_tmpdir(self, tmpdir):
os.unlink(link_name)

@pytest.fixture(autouse=True)
def _patched_path(self, tmpdir):
def patched_path(self, tmpdir):
"""
Patch sys.path to include the 'site-pkgs' dir. Also
restore pkg_resources._namespace_packages to its
Expand Down
6 changes: 4 additions & 2 deletions ruff.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ extend-select = [
"YTT", # flake8-2020
]
ignore = [
"PT004", # deprecated https://github.com/astral-sh/ruff/issues/8796#issuecomment-2057143531
"PT005", # deprecated https://github.com/astral-sh/ruff/issues/8796#issuecomment-2057143531
"PT007", # temporarily disabled, TODO: configure and standardize to preference
"PT011", # temporarily disabled, TODO: tighten expected error
"PT012", # pytest-raises-with-multiple-statements, avoid extra dummy methods for a few lines, sometimes we explicitly assert in case of no error
Expand Down Expand Up @@ -76,8 +78,8 @@ ignore-fully-untyped = true

[lint.flake8-pytest-style]
parametrize-names-type = "csv"
# These default to false in preview mode,
# we'll be able to remove this config eventually
# These default to false in non-preview mode in Ruff 0.6,
# we'll be able to remove this config once raising our minimum version
fixture-parentheses = false
mark-parentheses = false

Expand Down
4 changes: 2 additions & 2 deletions setuptools/tests/fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@


@pytest.fixture
def _user_override(monkeypatch):
def user_override(monkeypatch):
"""
Override site.USER_BASE and site.USER_SITE with temporary directories in
a context.
Expand All @@ -31,7 +31,7 @@ def tmpdir_cwd(tmpdir):


@pytest.fixture(autouse=True, scope="session")
def _workaround_xdist_376(request):
def workaround_xdist_376(request):
"""
Workaround pytest-dev/pytest-xdist#376
Expand Down
2 changes: 1 addition & 1 deletion setuptools/tests/integration/test_pip_install_sdist.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ def venv_python(tmp_path):


@pytest.fixture(autouse=True)
def _prepare(tmp_path, venv_python, monkeypatch):
def prepare(tmp_path, venv_python, monkeypatch):
download_path = os.getenv("DOWNLOAD_PATH", str(tmp_path))
os.makedirs(download_path, exist_ok=True)

Expand Down
4 changes: 2 additions & 2 deletions setuptools/tests/test_bdist_egg.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def setup_context(tmpdir):


class Test:
@pytest.mark.usefixtures("_user_override")
@pytest.mark.usefixtures("user_override")
@pytest.mark.usefixtures("setup_context")
def test_bdist_egg(self):
dist = Distribution(
Expand All @@ -52,7 +52,7 @@ def test_bdist_egg(self):
os.environ.get('PYTHONDONTWRITEBYTECODE', False),
reason="Byte code disabled",
)
@pytest.mark.usefixtures("_user_override")
@pytest.mark.usefixtures("user_override")
@pytest.mark.usefixtures("setup_context")
def test_exclude_source_files(self):
dist = Distribution(
Expand Down
2 changes: 1 addition & 1 deletion setuptools/tests/test_develop.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@


@pytest.fixture
def _temp_user(monkeypatch):
def temp_user(monkeypatch):
with contexts.tempdir() as user_base:
with contexts.tempdir() as user_site:
monkeypatch.setattr('site.USER_BASE', user_base)
Expand Down
8 changes: 4 additions & 4 deletions setuptools/tests/test_easy_install.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@


@pytest.fixture(autouse=True)
def _pip_disable_index(monkeypatch):
def pip_disable_index(monkeypatch):
"""
Important: Disable the default index for pip to avoid
querying packages in the index and potentially resolving
Expand Down Expand Up @@ -367,7 +367,7 @@ def setup_context(tmpdir):
yield tmpdir


@pytest.mark.usefixtures("_user_override")
@pytest.mark.usefixtures("user_override")
@pytest.mark.usefixtures("setup_context")
class TestUserInstallTest:
# prevent check that site-packages is writable. easy_install
Expand Down Expand Up @@ -461,7 +461,7 @@ def patched_setup_context(self):


@pytest.fixture
def _distutils_package():
def distutils_package():
distutils_setup_py = SETUP_PY.replace(
'from setuptools import setup',
'from distutils.core import setup',
Expand All @@ -472,7 +472,7 @@ def _distutils_package():
yield


@pytest.mark.usefixtures("_distutils_package")
@pytest.mark.usefixtures("distutils_package")
class TestDistutilsPackage:
def test_bdist_egg_available_on_distutils_pkg(self):
run_setup('setup.py', ['bdist_egg'])
Expand Down
6 changes: 3 additions & 3 deletions setuptools/tests/test_setuptools.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@


@pytest.fixture(autouse=True)
def _isolated_dir(tmpdir_cwd):
def isolated_dir(tmpdir_cwd):
return


Expand Down Expand Up @@ -244,7 +244,7 @@ def test_findall_curdir(example_source):


@pytest.fixture
def _can_symlink(tmpdir):
def can_symlink(tmpdir):
"""
Skip if cannot create a symbolic link
"""
Expand All @@ -257,7 +257,7 @@ def _can_symlink(tmpdir):
os.remove(link_fn)


@pytest.mark.usefixtures("_can_symlink")
@pytest.mark.usefixtures("can_symlink")
def test_findall_missing_symlink(tmpdir):
with tmpdir.as_cwd():
os.symlink('foo', 'bar')
Expand Down
2 changes: 1 addition & 1 deletion setuptools/tests/test_virtualenv.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@


@pytest.fixture(autouse=True)
def _pytest_virtualenv_works(venv):
def pytest_virtualenv_works(venv):
"""
pytest_virtualenv may not work. if it doesn't, skip these
tests. See #1284.
Expand Down

0 comments on commit 18042fb

Please sign in to comment.