diff --git a/bin/forge/test_forge.py b/bin/forge/test_forge.py index a026343f..44c49f23 100644 --- a/bin/forge/test_forge.py +++ b/bin/forge/test_forge.py @@ -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__": diff --git a/bin/loop_effects/test_effects.py b/bin/loop_effects/test_effects.py index de024575..38efc268 100644 --- a/bin/loop_effects/test_effects.py +++ b/bin/loop_effects/test_effects.py @@ -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."""