Skip to content

Commit

Permalink
Update pre-commit hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
ssbarnea committed Dec 10, 2024
1 parent c7f2caf commit d87e6ed
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 26 deletions.
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand All @@ -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
Expand All @@ -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
Expand Down
6 changes: 3 additions & 3 deletions src/tox/execute/request.py
Original file line number Diff line number Diff line change
Expand Up @@ -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})"
Expand Down
4 changes: 2 additions & 2 deletions src/tox/pytest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
12 changes: 6 additions & 6 deletions src/tox/tox_env/python/virtual_env/package/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
16 changes: 8 additions & 8 deletions tests/execute/local_subprocess/test_local_subprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
8 changes: 4 additions & 4 deletions tests/test_provision.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit d87e6ed

Please sign in to comment.