|
5 | 5 | from usethis._config import usethis_config |
6 | 6 | from usethis._fallback import ( |
7 | 7 | FALLBACK_CODESPELL_VERSION, |
| 8 | + FALLBACK_HATCHLING_VERSION, |
8 | 9 | FALLBACK_PRE_COMMIT_VERSION, |
9 | 10 | FALLBACK_PYPROJECT_FMT_VERSION, |
10 | 11 | FALLBACK_RUFF_VERSION, |
11 | 12 | FALLBACK_SYNC_WITH_UV_VERSION, |
12 | 13 | FALLBACK_UV_VERSION, |
| 14 | + next_breaking_version, |
13 | 15 | ) |
14 | 16 | from usethis._integrations.ci.github.errors import GitHubTagError |
15 | 17 | from usethis._integrations.ci.github.tags import get_github_latest_tag |
@@ -40,6 +42,22 @@ def test_latest_version(self): |
40 | 42 | raise err |
41 | 43 |
|
42 | 44 |
|
| 45 | +class TestFallbackHatchlingVersion: |
| 46 | + @pytest.mark.usefixtures("_vary_network_conn") |
| 47 | + def test_latest_version(self): |
| 48 | + if os.getenv("CI"): |
| 49 | + pytest.skip("Avoid flaky pipelines by testing version bumps manually") |
| 50 | + |
| 51 | + try: |
| 52 | + assert ( |
| 53 | + get_github_latest_tag(owner="pypa", repo="hatch") |
| 54 | + == f"hatchling-v{FALLBACK_HATCHLING_VERSION}" |
| 55 | + ) |
| 56 | + except GitHubTagError as err: |
| 57 | + _skip_on_github_error(err) |
| 58 | + raise err |
| 59 | + |
| 60 | + |
43 | 61 | class TestPreCommitVersion: |
44 | 62 | @pytest.mark.usefixtures("_vary_network_conn") |
45 | 63 | def test_latest_version(self): |
@@ -120,3 +138,20 @@ def test_latest_version(self): |
120 | 138 | except GitHubTagError as err: |
121 | 139 | _skip_on_github_error(err) |
122 | 140 | raise err |
| 141 | + |
| 142 | + |
| 143 | +class TestNextBreakingVersion: |
| 144 | + def test_pre_one_bumps_minor(self): |
| 145 | + assert next_breaking_version("0.10.2") == "0.11.0" |
| 146 | + |
| 147 | + def test_post_one_bumps_major(self): |
| 148 | + assert next_breaking_version("1.0.2") == "2.0.0" |
| 149 | + |
| 150 | + def test_pre_one_zero_minor(self): |
| 151 | + assert next_breaking_version("0.0.5") == "0.1.0" |
| 152 | + |
| 153 | + def test_exact_one(self): |
| 154 | + assert next_breaking_version("1.0.0") == "2.0.0" |
| 155 | + |
| 156 | + def test_high_major(self): |
| 157 | + assert next_breaking_version("3.2.1") == "4.0.0" |
0 commit comments