From d87e6ed3d94daaa5f3697fb37d34012ee1b67291 Mon Sep 17 00:00:00 2001 From: Sorin Sbarnea Date: Tue, 10 Dec 2024 17:01:43 +0000 Subject: [PATCH] Update pre-commit hooks --- .pre-commit-config.yaml | 6 +++--- src/tox/execute/request.py | 6 +++--- src/tox/pytest.py | 4 ++-- .../tox_env/python/virtual_env/package/util.py | 12 ++++++------ .../local_subprocess/test_local_subprocess.py | 16 ++++++++-------- tests/test_provision.py | 8 ++++---- 6 files changed, 26 insertions(+), 26 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 96dd990af..4e7b1ec36 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -5,7 +5,7 @@ repos: - id: end-of-file-fixer - id: trailing-whitespace - repo: https://github.com/python-jsonschema/check-jsonschema - rev: 0.29.4 + rev: 0.30.0 hooks: - id: check-github-workflows args: ["--verbose"] @@ -23,7 +23,7 @@ repos: hooks: - id: validate-pyproject - repo: https://github.com/astral-sh/ruff-pre-commit - rev: "v0.8.0" + rev: "v0.8.2" hooks: - id: ruff-format - id: ruff @@ -38,7 +38,7 @@ repos: hooks: - id: rst-backticks - repo: https://github.com/rbubley/mirrors-prettier - rev: "v3.3.3" + rev: "v3.4.2" hooks: - id: prettier - repo: local diff --git a/src/tox/execute/request.py b/src/tox/execute/request.py index f84d50a78..817444080 100644 --- a/src/tox/execute/request.py +++ b/src/tox/execute/request.py @@ -59,9 +59,9 @@ def shell_cmd(self) -> str: exe = str(Path(self.cmd[0]).relative_to(self.cwd)) except ValueError: exe = self.cmd[0] - _cmd = [exe] - _cmd.extend(self.cmd[1:]) - return shell_cmd(_cmd) + cmd = [exe] + cmd.extend(self.cmd[1:]) + return shell_cmd(cmd) def __repr__(self) -> str: return f"{self.__class__.__name__}(cmd={self.cmd!r}, cwd={self.cwd!r}, env=..., stdin={self.stdin!r})" diff --git a/src/tox/pytest.py b/src/tox/pytest.py index 72f410bf5..a5aaaac87 100644 --- a/src/tox/pytest.py +++ b/src/tox/pytest.py @@ -492,10 +492,10 @@ def _invalid_index_fake_port() -> int: @pytest.fixture(autouse=True) -def disable_pip_pypi_access(_invalid_index_fake_port: int, monkeypatch: pytest.MonkeyPatch) -> tuple[str, str | None]: +def disable_pip_pypi_access(invalid_index_fake_port: int, monkeypatch: pytest.MonkeyPatch) -> tuple[str, str | None]: """Set a fake pip index url, tests that want to use a pypi server should create and overwrite this.""" previous_url = os.environ.get("PIP_INDEX_URL") - new_url = f"http://localhost:{_invalid_index_fake_port}/bad-pypi-server" + new_url = f"http://localhost:{invalid_index_fake_port}/bad-pypi-server" monkeypatch.setenv("PIP_INDEX_URL", new_url) monkeypatch.setenv("PIP_RETRIES", str(0)) monkeypatch.setenv("PIP_TIMEOUT", str(0.001)) diff --git a/src/tox/tox_env/python/virtual_env/package/util.py b/src/tox/tox_env/python/virtual_env/package/util.py index 4d262a7f5..2bbc1501a 100644 --- a/src/tox/tox_env/python/virtual_env/package/util.py +++ b/src/tox/tox_env/python/virtual_env/package/util.py @@ -73,12 +73,12 @@ def _extract_extra_markers(req: Requirement) -> tuple[Requirement, set[str | Non return req, cast("Set[Optional[str]]", extra_markers) or {None} -def _get_extra(_marker: str | tuple[Variable, Op, Variable]) -> str | None: +def _get_extra(marker: str | tuple[Variable, Op, Variable]) -> str | None: if ( - isinstance(_marker, tuple) - and len(_marker) == 3 # noqa: PLR2004 - and _marker[0].value == "extra" - and _marker[1].value == "==" + isinstance(marker, tuple) + and len(marker) == 3 # noqa: PLR2004 + and marker[0].value == "extra" + and marker[1].value == "==" ): - return _marker[2].value + return marker[2].value return None diff --git a/tests/execute/local_subprocess/test_local_subprocess.py b/tests/execute/local_subprocess/test_local_subprocess.py index 2bfb542e8..d3ed37da7 100644 --- a/tests/execute/local_subprocess/test_local_subprocess.py +++ b/tests/execute/local_subprocess/test_local_subprocess.py @@ -234,14 +234,14 @@ def test_local_execute_basic_fail(capsys: CaptureFixture, caplog: LogCaptureFixt assert record.levelno == logging.CRITICAL assert record.msg == "exit %s (%.2f seconds) %s> %s%s" assert record.args is not None - _code, _duration, _cwd, _cmd, _metadata = record.args - assert _code == 3 - assert _cwd == cwd - assert _cmd == request.shell_cmd - assert isinstance(_duration, float) - assert _duration > 0 - assert isinstance(_metadata, str) - assert _metadata.startswith(" pid=") + code, duration, cwd_, cmd_, metadata = record.args + assert code == 3 + assert cwd_ == cwd + assert cmd_ == request.shell_cmd + assert isinstance(duration, float) + assert duration > 0 + assert isinstance(metadata, str) + assert metadata.startswith(" pid=") def test_command_does_not_exist(caplog: LogCaptureFixture, os_env: dict[str, str]) -> None: diff --git a/tests/test_provision.py b/tests/test_provision.py index 5b2b652b3..2030cb922 100644 --- a/tests/test_provision.py +++ b/tests/test_provision.py @@ -62,12 +62,12 @@ def _make_tox_wheel( into = tmp_path_factory.mktemp("dist") # pragma: no cover from tox.version import version_tuple # noqa: PLC0415 - _patch_version = version_tuple[2] - if isinstance(_patch_version, str) and _patch_version[:3] == "dev": + patch_version = version_tuple[2] + if isinstance(patch_version, str) and patch_version[:3] == "dev": # Version is in the form of 1.23.dev456, we need to increment the 456 part - version = f"{version_tuple[0]}.{version_tuple[1]}.dev{int(_patch_version[3:]) + 1}" + version = f"{version_tuple[0]}.{version_tuple[1]}.dev{int(patch_version[3:]) + 1}" else: - version = f"{version_tuple[0]}.{version_tuple[1]}.{int(_patch_version) + 1}" + version = f"{version_tuple[0]}.{version_tuple[1]}.{int(patch_version) + 1}" with mock.patch.dict(os.environ, {"SETUPTOOLS_SCM_PRETEND_VERSION": version}): return pkg_builder(into, Path(__file__).parents[1], ["wheel"], False) # pragma: no cover