Skip to content

Commit f5de1ea

Browse files
committed
chore(golden): clean ruff nits in new tests/golden/ files
Drop unused pytest/yaml imports across the new tests, and replace the rename-detection magic number in check_semver_bump.py with a named constant. No behavior change. Surfaces from ruff check tests/golden when run directly (the project's `make lint` target restricts to samcli/schema, so these escaped CI).
1 parent 61592ef commit f5de1ea

7 files changed

Lines changed: 4 additions & 14 deletions

File tree

tests/golden/check_semver_bump.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@
1616

1717
EXPECTED_GLOB = re.compile(r"^tests/golden/templates/.+/expected\.(build|package)\.yaml$")
1818

19+
# git diff --name-status emits "R<score>\tOLD\tNEW" for renames (3 fields).
20+
_RENAME_DIFF_PARTS = 3
21+
1922

2023
@dataclass(frozen=True)
2124
class Change:
@@ -102,7 +105,7 @@ def _git_changed_files(base: str, head: str) -> List[Change]:
102105
parts = line.split("\t")
103106
status, path = parts[0], parts[-1]
104107
# Renames present as "R<score>\tOLD\tNEW" — split into D + A for our purposes.
105-
if status.startswith("R") and len(parts) == 3:
108+
if status.startswith("R") and len(parts) == _RENAME_DIFF_PARTS:
106109
old, new = parts[1], parts[2]
107110
changes.append(Change(old, "D"))
108111
changes.append(Change(new, "A"))

tests/golden/conftest.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66

77
from pathlib import Path
88

9-
import pytest
10-
119
TEMPLATES_ROOT = Path(__file__).parent / "templates"
1210

1311

tests/golden/test_check_semver_bump.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
the lower-level entrypoint.
55
"""
66

7-
import pytest
8-
97
from tests.golden import check_semver_bump as csb
108

119

tests/golden/test_corpus.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
from pathlib import Path
44

5-
import pytest
6-
75
from tests.golden.harness import run_build_pipeline, run_package_pipeline
86
from tests.golden.normalize import normalize
97
from tests.golden.update_goldens import _read_metadata, _resolve_le_default

tests/golden/test_harness_build.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@
22

33
from pathlib import Path
44

5-
import pytest
6-
import yaml
7-
85
from tests.golden.harness import run_build_pipeline
96

107
CASES_ROOT = Path(__file__).parent / "templates"

tests/golden/test_harness_package.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
from pathlib import Path
44

5-
import pytest
6-
75
from tests.golden.harness import run_build_pipeline, run_package_pipeline
86

97
CASES_ROOT = Path(__file__).parent / "templates"

tests/golden/test_normalize.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
"""Unit tests for normalize() — deterministic YAML serialization."""
22

3-
import pytest
4-
53
from tests.golden.normalize import normalize
64

75

0 commit comments

Comments
 (0)