Answer stability round 1: 0 🔴, 3 🟡 (0 misread); give an awaits-a-slot chunk no since, print the time in UTC and keep the status lines tested once
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
import datetime
|
||||
import os
|
||||
import pathlib
|
||||
import tempfile
|
||||
@@ -10,8 +9,8 @@ from do_epic.test_scheduler import issue, Tmux
|
||||
from failure import Failure
|
||||
|
||||
SINCE = 1_700_000_000
|
||||
# How the status prints SINCE, in the machine's time zone.
|
||||
SINCE_ON = datetime.datetime.fromtimestamp(SINCE).strftime("%Y-%m-%d %H:%M")
|
||||
# SINCE as the status prints it.
|
||||
SINCE_ON = "2023-11-14 22:13 UTC"
|
||||
EPIC = "epic-ABC-12"
|
||||
|
||||
|
||||
@@ -20,10 +19,9 @@ class TheStatusLines(unittest.TestCase):
|
||||
self.home = pathlib.Path(tempfile.mkdtemp())
|
||||
self.folder = self.home / STATE / "ABC-12"
|
||||
|
||||
def park(self, key: str, on: str, since: int | None = SINCE) -> None:
|
||||
def park(self, key: str, on: str) -> None:
|
||||
parked.park(self.folder, parked.Parked(key, f"/code/api-{key}", "7", "s", on))
|
||||
if since is not None:
|
||||
os.utime(parked.file_of(self.folder, key), (since, since))
|
||||
os.utime(parked.file_of(self.folder, key), (SINCE, SINCE))
|
||||
|
||||
def lines(self, issues: list, *windows: tuple[str, str, bool, str]) -> list[str] | Failure:
|
||||
return status.lines("ABC-12", self.home, issues, Tmux(*windows))
|
||||
@@ -36,6 +34,10 @@ class TheStatusLines(unittest.TestCase):
|
||||
self.park("ABC-20", "an approval")
|
||||
self.assertEqual(self.lines([issue("ABC-20", "repo:api")], (EPIC, "ABC-20 awaits its checks", False, "")), [f"ABC-20 waits: it is parked: its pull request #7 awaits its checks, since {SINCE_ON}"])
|
||||
|
||||
def test_a_parked_chunk_that_awaits_a_slot_gives_no_time_since_its_gate_began(self) -> None:
|
||||
self.park("ABC-20", "an approval")
|
||||
self.assertEqual(self.lines([issue("ABC-20", "repo:api")], (EPIC, "ABC-20 awaits a slot", False, "")), ["ABC-20 waits: it is parked: its worker has work again on pull request #7 and awaits a slot"])
|
||||
|
||||
def test_a_parked_chunk_without_a_window_says_since_when_and_how_to_start_it_again(self) -> None:
|
||||
self.park("ABC-20", "an approval")
|
||||
self.assertEqual(self.lines([issue("ABC-20", "repo:api")]), [f"ABC-20 waits: it is parked: its pull request #7 awaits an approval, since {SINCE_ON}, and its window stopped; run `do-epic ABC-12` to start it again"])
|
||||
|
||||
Reference in New Issue
Block a user