Skip to content

Commit f6e33be

Browse files
Bump the pyproject-fmt version to v2.6.0 from v2.5.0 Test that hard-… (#799)
* Bump the pyproject-fmt version to v2.6.0 from v2.5.0 Test that hard-coded pre-commit versions are up-to-date * Add test skipping to cope with rate limiting
1 parent cb75978 commit f6e33be

3 files changed

Lines changed: 45 additions & 1 deletion

File tree

src/usethis/_tool/impl/pyproject_fmt.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ def get_pre_commit_config(self) -> PreCommitConfig:
7777
return PreCommitConfig.from_single_repo(
7878
UriRepo(
7979
repo="https://github.com/tox-dev/pyproject-fmt",
80-
rev="v2.5.0", # Manually bump this version when necessary
80+
rev="v2.6.0", # Manually bump this version when necessary
8181
hooks=[HookDefinition(id="pyproject-fmt")],
8282
),
8383
requires_venv=False,
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import os
2+
3+
import pytest
4+
5+
from usethis._integrations.ci.github.errors import GitHubTagError
6+
from usethis._integrations.ci.github.tags import get_github_latest_tag
7+
from usethis._integrations.pre_commit.schema import UriRepo
8+
from usethis._tool.impl.codespell import CodespellTool
9+
10+
11+
class TestCodespellTool:
12+
def test_latest_version(self):
13+
(config,) = CodespellTool().get_pre_commit_config().repo_configs
14+
repo = config.repo
15+
assert isinstance(repo, UriRepo)
16+
try:
17+
assert repo.rev == get_github_latest_tag(
18+
owner="codespell-project", repo="codespell"
19+
)
20+
except GitHubTagError as err:
21+
if os.getenv("CI"):
22+
pytest.skip(
23+
"Failed to fetch GitHub tags (connection issues); skipping test"
24+
)
25+
raise err

tests/usethis/_tool/impl/test_pyproject_fmt.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
1+
import os
12
from pathlib import Path
23

34
import pytest
45

56
from usethis._config_file import files_manager
7+
from usethis._integrations.ci.github.errors import GitHubTagError
8+
from usethis._integrations.ci.github.tags import get_github_latest_tag
9+
from usethis._integrations.pre_commit.schema import UriRepo
610
from usethis._test import change_cwd
711
from usethis._tool.impl.pyproject_fmt import PyprojectFmtTool
812

@@ -23,3 +27,18 @@ def test_uv_only(self, tmp_path: Path, capfd: pytest.CaptureFixture[str]):
2327
assert out == (
2428
"☐ Run 'uv run pyproject-fmt pyproject.toml' to run pyproject-fmt.\n"
2529
)
30+
31+
def test_latest_version(self):
32+
(config,) = PyprojectFmtTool().get_pre_commit_config().repo_configs
33+
repo = config.repo
34+
assert isinstance(repo, UriRepo)
35+
try:
36+
assert repo.rev == get_github_latest_tag(
37+
owner="tox-dev", repo="pyproject-fmt"
38+
)
39+
except GitHubTagError as err:
40+
if os.getenv("CI"):
41+
pytest.skip(
42+
"Failed to fetch GitHub tags (connection issues); skipping test"
43+
)
44+
raise err

0 commit comments

Comments
 (0)