Answer product-owner round 1: 0 🔴, 2 🟡 (0 misread); refuse to count a blocking report with no finding headings, and say to count by hand
This commit is contained in:
@@ -44,10 +44,14 @@ def standing_report(folder: pathlib.Path, pass_: str, round_: int) -> pathlib.Pa
|
||||
|
||||
|
||||
def findings_in(report: pathlib.Path) -> Findings | Failure:
|
||||
"""The findings a round's report gives, as round_titles.reported counts them."""
|
||||
"""The findings a round's report gives, as round_titles.reported counts them; a Failure where the report blocks yet heads no finding as review-findings.md → "Report" asks, since its count would then be wrong."""
|
||||
try:
|
||||
return reported(report.read_text(encoding="utf-8"))
|
||||
text = report.read_text(encoding="utf-8")
|
||||
except FileNotFoundError:
|
||||
return Failure(f"no report at {report}")
|
||||
except (OSError, UnicodeDecodeError) as failure:
|
||||
return Failure(f"could not read {report}: {failure}")
|
||||
findings = reported(text)
|
||||
if text.lstrip().startswith("BLOCK") and findings.red + findings.yellow == 0:
|
||||
return Failure(f"{report} says BLOCK but opens no finding with `### 🔴` or `### 🟡`; count its findings by hand")
|
||||
return findings
|
||||
|
||||
@@ -40,3 +40,12 @@ class RoundReport(unittest.TestCase):
|
||||
unread = findings_in(standing_report(pathlib.Path(temp), "prose", 1))
|
||||
self.assertIsInstance(unread, Failure)
|
||||
self.assertTrue(unread.reason.startswith(f"could not read {temp}/prose-round-1.md: "), unread.reason)
|
||||
|
||||
def test_names_a_blocking_report_that_heads_no_finding_as_its_format_asks(self):
|
||||
with tempfile.TemporaryDirectory() as temp:
|
||||
(pathlib.Path(temp) / "prose-round-1.md").write_text("BLOCK\n\n## 🟡 Should fix\n\n### 1. `a.md:1`: worse\n")
|
||||
unread = findings_in(standing_report(pathlib.Path(temp), "prose", 1))
|
||||
self.assertIsInstance(unread, Failure)
|
||||
self.assertEqual(unread.reason, f"{temp}/prose-round-1.md says BLOCK but opens no finding with `### 🔴` or `### 🟡`; count its findings by hand")
|
||||
(pathlib.Path(temp) / "prose-round-1.md").write_text("APPROVE\n")
|
||||
self.assertEqual(findings_in(standing_report(pathlib.Path(temp), "prose", 1)), Findings(0, 0, 0))
|
||||
|
||||
Reference in New Issue
Block a user