Answer stability round 1: 0 🔴, 17 🟡 (0 misread); read line ends as before, drop a stale copy, say why a read failed, and test each failure the round named
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import contextlib
|
||||
import os
|
||||
import pathlib
|
||||
import subprocess
|
||||
@@ -9,6 +10,7 @@ sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[1]))
|
||||
|
||||
from score_outcomes.anchors import anchor_lines, parse_anchors
|
||||
from branch_chunks.cut import BranchChunk, Landing
|
||||
from project_config.test_project_config import configured, write_config
|
||||
from failure import Failure
|
||||
from score_outcomes.results import file_lines, NamedCode, nearest, rank_correlation, render, report, Result, results_of
|
||||
from review_rules.round_titles import Findings
|
||||
@@ -16,9 +18,8 @@ from test_env import isolated_env
|
||||
from release_plan.todo_table import Item
|
||||
from transcript_archive import outcomes
|
||||
from transcript_archive.location import project_archive
|
||||
from score_outcomes.main import report_text
|
||||
from score_outcomes.main import read_anchors, report_text
|
||||
from score_outcomes.reversals import reversal_lines
|
||||
from project_config.test_project_config import write_config
|
||||
|
||||
TOOL = pathlib.Path(__file__).resolve().parents[1] / "score-outcomes"
|
||||
HEADER = "| ID | Release | Exempt | Item | R | S | C | A | G | Goals | Score |\n|---|---|---|---|---|---|---|---|---|---|---|\n"
|
||||
@@ -549,5 +550,16 @@ class Reversals(unittest.TestCase):
|
||||
self.assertTrue(found.reason.startswith(f"could not read the archive file {archive / 'kept' / 'b.outcomes.md'}: "), found.reason)
|
||||
|
||||
|
||||
class ReadAnchors(unittest.TestCase):
|
||||
def test_fails_on_anchors_it_cannot_read_rather_than_scoring_without_them(self):
|
||||
checkout = pathlib.Path(self.enterContext(tempfile.TemporaryDirectory()))
|
||||
configured(self, checkout)
|
||||
self.enterContext(contextlib.chdir(checkout))
|
||||
anchors = checkout.resolve() / "docs" / "score-anchors.md"
|
||||
anchors.parent.mkdir()
|
||||
anchors.write_bytes(b"\xff")
|
||||
self.assertEqual(read_anchors(), Failure(f"cannot read {anchors}: not UTF-8 on line 1"))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
||||
Reference in New Issue
Block a user