|
12 | 12 |
|
13 | 13 | import run_release |
14 | 14 | from release import ReleaseShelf, Tag |
15 | | -from run_release import ReleaseException |
| 15 | +from run_release import ( |
| 16 | + BLURB_VERSION_PATTERN, |
| 17 | + SIGSTORE_VERSION_PATTERN, |
| 18 | + ReleaseException, |
| 19 | +) |
16 | 20 |
|
17 | 21 |
|
18 | 22 | @pytest.mark.parametrize( |
19 | | - "version", |
20 | | - ["sigstore 4.0.0", "sigstore 4.1.0"], |
| 23 | + ["version", "pattern", "minimum"], |
| 24 | + [ |
| 25 | + ("blurb version 2.2.0", BLURB_VERSION_PATTERN, (2, 2)), |
| 26 | + ("blurb version 2.10.0", BLURB_VERSION_PATTERN, (2, 2)), |
| 27 | + ("blurb version 3.0.0", BLURB_VERSION_PATTERN, (2, 2)), |
| 28 | + ("sigstore 4.0", SIGSTORE_VERSION_PATTERN, (4, 0)), |
| 29 | + ("sigstore 4.0.0", SIGSTORE_VERSION_PATTERN, (4, 0)), |
| 30 | + ("sigstore 4.1.0", SIGSTORE_VERSION_PATTERN, (4, 0)), |
| 31 | + ], |
21 | 32 | ) |
22 | | -def test_check_sigstore_version_success(version: str) -> None: |
| 33 | +def test_check_tool_version_success( |
| 34 | + version: str, pattern: str, minimum: tuple[int, ...] |
| 35 | +) -> None: |
23 | 36 | # Verify runs with no exceptions |
24 | | - run_release.check_sigstore_version(version) |
| 37 | + run_release.check_tool_version("tool", version, pattern, minimum) |
25 | 38 |
|
26 | 39 |
|
27 | 40 | @pytest.mark.parametrize( |
28 | | - "version", |
29 | | - ["sigstore 3.4.0", "sigstore 3.6.2", "sigstore 3.6.6", ""], |
| 41 | + ["version", "pattern", "minimum"], |
| 42 | + [ |
| 43 | + ("blurb version 1.3.0", BLURB_VERSION_PATTERN, (2, 2)), |
| 44 | + ("blurb version 2.1.0", BLURB_VERSION_PATTERN, (2, 2)), |
| 45 | + ("sigstore 3.6.6", SIGSTORE_VERSION_PATTERN, (4, 0)), |
| 46 | + ("sigstore 4.0.0", BLURB_VERSION_PATTERN, (2, 2)), |
| 47 | + ("", BLURB_VERSION_PATTERN, (2, 2)), |
| 48 | + ], |
30 | 49 | ) |
31 | | -def test_check_sigstore_version_exception(version: str) -> None: |
| 50 | +def test_check_tool_version_exception( |
| 51 | + version: str, pattern: str, minimum: tuple[int, ...] |
| 52 | +) -> None: |
| 53 | + expected = ".".join(str(part) for part in minimum) |
32 | 54 | with pytest.raises( |
33 | | - ReleaseException, match="Sigstore version not detected or not valid" |
| 55 | + ReleaseException, |
| 56 | + match=rf"tool version not detected or not valid\. Expecting >= {expected}", |
34 | 57 | ): |
35 | | - run_release.check_sigstore_version(version) |
| 58 | + run_release.check_tool_version("tool", version, pattern, minimum) |
36 | 59 |
|
37 | 60 |
|
38 | 61 | @pytest.mark.parametrize( |
|
0 commit comments