Answer architecture round 1: 1 🔴, 2 🟡 (0 misread); render the stamp through Effects.local_time
This commit is contained in:
@@ -20,7 +20,7 @@ sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[1]))
|
||||
from routing_figures import archive, measure
|
||||
from loop_claude.project import checkout, model_choice, records
|
||||
from chunk_pick import DefaultPlan, LastCut
|
||||
from loop_claude.effects import Effects, PYTHON_TIMEOUT, run_python
|
||||
from loop_claude.effects import Effects, PYTHON_TIMEOUT, run_python, system_effects
|
||||
from claude_code import entries, reply, session
|
||||
from loop_claude import escalation_mark, paths, routing, terminal
|
||||
from failure import Failure
|
||||
@@ -47,17 +47,8 @@ OPUS_179_AT_6 = '{"model": "claude-opus-5-5", "effort": "medium", "item": 179, "
|
||||
|
||||
CWD = pathlib.Path("/c")
|
||||
NOW = 1790000000
|
||||
# How a line said at NOW opens in a zone two hours ahead of UTC, which setUpModule sets: a stamp in UTC would read 14:13:20.
|
||||
STAMP = "2026-09-21 16:13:20"
|
||||
|
||||
|
||||
def setUpModule():
|
||||
zone = unittest.mock.patch.dict(os.environ, {"TZ": "XXX-2"})
|
||||
zone.start()
|
||||
# Cleanups run last in, first out: the zone is restored before the clock rereads it.
|
||||
unittest.addModuleCleanup(time.tzset)
|
||||
unittest.addModuleCleanup(zone.stop)
|
||||
time.tzset()
|
||||
# How a line said at NOW opens, with FakeEffects' local_time.
|
||||
STAMP = f"<{NOW}>"
|
||||
|
||||
|
||||
def assistant(*parts):
|
||||
@@ -1118,6 +1109,17 @@ class ChunkFacts(unittest.TestCase):
|
||||
self.assertEqual((resumed.made("python"), facts), ([], ""))
|
||||
|
||||
|
||||
class LocalTime(unittest.TestCase):
|
||||
def test_renders_seconds_in_the_machines_zone(self):
|
||||
# A POSIX zone two hours ahead of UTC, so a time in UTC would read 14:13:20. Cleanups run last in, first out: the zone is restored before the clock rereads it.
|
||||
self.addCleanup(time.tzset)
|
||||
zone = unittest.mock.patch.dict(os.environ, {"TZ": "XXX-2"})
|
||||
zone.start()
|
||||
self.addCleanup(zone.stop)
|
||||
time.tzset()
|
||||
self.assertEqual(system_effects().local_time(NOW), "2026-09-21 16:13:20")
|
||||
|
||||
|
||||
class PythonEffect(unittest.TestCase):
|
||||
def test_runs_a_script_in_the_given_directory(self):
|
||||
with tempfile.TemporaryDirectory() as cwd:
|
||||
|
||||
Reference in New Issue
Block a user