Test the forge runner's folder and timeout message, and the loop's forge effect
CI / tests (pull_request) Has been cancelled
CI / tests (pull_request) Has been cancelled
This commit is contained in:
@@ -1,7 +1,9 @@
|
|||||||
import itertools
|
import itertools
|
||||||
import json
|
import json
|
||||||
|
import os
|
||||||
import pathlib
|
import pathlib
|
||||||
import sys
|
import sys
|
||||||
|
import tempfile
|
||||||
import typing
|
import typing
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
@@ -170,7 +172,9 @@ class Runner(unittest.TestCase):
|
|||||||
failed = runner("/")(["no-such-forge-cli", "pr", "list"])
|
failed = runner("/")(["no-such-forge-cli", "pr", "list"])
|
||||||
self.assertIsInstance(failed, Failure)
|
self.assertIsInstance(failed, Failure)
|
||||||
self.assertTrue(failed.reason.startswith("no-such-forge-cli could not start: "), failed.reason)
|
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__":
|
if __name__ == "__main__":
|
||||||
|
|||||||
@@ -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):
|
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."""
|
"""Each test runs a fake tmux off its own PATH, without $TMUX, so the human's tmux server is never reached."""
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user