Test the forge runner's folder and timeout message, and the loop's forge effect
CI / tests (pull_request) Has been cancelled

This commit is contained in:
Lilleman
2026-11-20 00:12:55 +01:00
parent 0c52688ff8
commit 7f9237e91e
2 changed files with 11 additions and 1 deletions
+5 -1
View File
@@ -1,7 +1,9 @@
import itertools
import json
import os
import pathlib
import sys
import tempfile
import typing
import unittest
@@ -170,7 +172,9 @@ class Runner(unittest.TestCase):
failed = runner("/")(["no-such-forge-cli", "pr", "list"])
self.assertIsInstance(failed, Failure)
self.assertTrue(failed.reason.startswith("no-such-forge-cli could not start: "), failed.reason)
self.assertEqual(runner("/", 0.05)(["sleep", "5"]), Failure("sleep 5: stopped after 0.05 s"))
self.assertEqual(runner("/", 0.05)(["sh", "-c", "sleep 5", "later"]), Failure("sh -c sleep 5: stopped after 0.05 s"))
with tempfile.TemporaryDirectory() as folder:
self.assertEqual(runner(folder)(["pwd", "-P"]), os.path.realpath(folder) + "\n")
if __name__ == "__main__":
+6
View File
@@ -99,6 +99,12 @@ class ClaudeOnTerminal(unittest.TestCase):
class ForgeEffect(unittest.TestCase):
def test_runs_the_forges_cli_in_the_checkout_it_is_given(self):
with tempfile.TemporaryDirectory() as folder:
self.assertEqual(system_effects(pathlib.Path.home(), os.environ).forge(folder)(["pwd", "-P"]), os.path.realpath(folder) + "\n")
class TmuxEffect(unittest.TestCase):
"""Each test runs a fake tmux off its own PATH, without $TMUX, so the human's tmux server is never reached."""