Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/usethis/_tool/impl/pyproject_fmt.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def get_pre_commit_config(self) -> PreCommitConfig:
return PreCommitConfig.from_single_repo(
UriRepo(
repo="https://github.com/tox-dev/pyproject-fmt",
rev="v2.5.0", # Manually bump this version when necessary
rev="v2.6.0", # Manually bump this version when necessary
hooks=[HookDefinition(id="pyproject-fmt")],
),
requires_venv=False,
Expand Down
25 changes: 25 additions & 0 deletions tests/usethis/_tool/impl/test_codespell.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import os

import pytest

from usethis._integrations.ci.github.errors import GitHubTagError
from usethis._integrations.ci.github.tags import get_github_latest_tag
from usethis._integrations.pre_commit.schema import UriRepo
from usethis._tool.impl.codespell import CodespellTool


class TestCodespellTool:
def test_latest_version(self):
(config,) = CodespellTool().get_pre_commit_config().repo_configs
repo = config.repo
assert isinstance(repo, UriRepo)
try:
assert repo.rev == get_github_latest_tag(
owner="codespell-project", repo="codespell"
)
except GitHubTagError as err:
if os.getenv("CI"):
pytest.skip(
"Failed to fetch GitHub tags (connection issues); skipping test"
)
raise err
19 changes: 19 additions & 0 deletions tests/usethis/_tool/impl/test_pyproject_fmt.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
import os
from pathlib import Path

import pytest

from usethis._config_file import files_manager
from usethis._integrations.ci.github.errors import GitHubTagError
from usethis._integrations.ci.github.tags import get_github_latest_tag
from usethis._integrations.pre_commit.schema import UriRepo
from usethis._test import change_cwd
from usethis._tool.impl.pyproject_fmt import PyprojectFmtTool

Expand All @@ -23,3 +27,18 @@ def test_uv_only(self, tmp_path: Path, capfd: pytest.CaptureFixture[str]):
assert out == (
"☐ Run 'uv run pyproject-fmt pyproject.toml' to run pyproject-fmt.\n"
)

def test_latest_version(self):
(config,) = PyprojectFmtTool().get_pre_commit_config().repo_configs
repo = config.repo
assert isinstance(repo, UriRepo)
try:
assert repo.rev == get_github_latest_tag(
owner="tox-dev", repo="pyproject-fmt"
)
except GitHubTagError as err:
if os.getenv("CI"):
pytest.skip(
"Failed to fetch GitHub tags (connection issues); skipping test"
)
raise err