Files
portfolio-hub/tests/release/test_ruff_ratchet.py
T
genichin 4520fbbfbd
Publish verified PortfolioHub image / verify (push) Canceled after 0s
Publish verified PortfolioHub image / publish (push) Canceled after 0s
ci(release): enforce changed-scope Ruff gate
2026-09-13 15:41:35 +09:00

34 lines
1.0 KiB
Python

from collections import Counter
from scripts.ruff_ratchet import normalized_findings
def test_normalized_findings_ignore_line_number_changes(tmp_path):
source = tmp_path / "sample.py"
source.write_text("\nvalue = missing\n", encoding="utf-8")
diagnostics = [
{
"filename": str(source),
"code": "F821",
"message": "Undefined name `missing`",
"location": {"row": 2, "column": 9},
}
]
assert normalized_findings(diagnostics, tmp_path) == Counter(
{("sample.py", "F821", "Undefined name `missing`", "value = missing"): 1}
)
def test_normalized_findings_preserve_duplicate_count(tmp_path):
source = tmp_path / "sample.py"
source.write_text("missing\n", encoding="utf-8")
diagnostic = {
"filename": str(source),
"code": "F821",
"message": "Undefined name `missing`",
"location": {"row": 1, "column": 1},
}
assert normalized_findings([diagnostic, diagnostic], tmp_path).total() == 2