Assistant: codex Assistant-Model: gpt-5.6-sol Assistant-Session: 01a03397-4d51-7fd1-8ff2-946eb22ea2bc
This commit is contained in:
parent
408d32df88
commit
74b2f27997
20 changed files with 608 additions and 182 deletions
|
|
@ -1,6 +1,6 @@
|
|||
import json
|
||||
|
||||
from tamq.cli import build_parser, main
|
||||
from tamq.cli import build_parser, main, normalize_argv
|
||||
import pytest
|
||||
|
||||
|
||||
|
|
@ -33,9 +33,32 @@ def test_start_parser_supports_command_and_cmd_alias():
|
|||
parser = build_parser()
|
||||
canonical = parser.parse_args(["start", "--command", "codex --quiet", "a", "b"])
|
||||
compatibility = parser.parse_args(["start", "--cmd", "claude", "a"])
|
||||
assert canonical.agent_command == "codex --quiet"
|
||||
neutral = parser.parse_args(["start", "a", "b"])
|
||||
assert canonical.initial_command == "codex --quiet"
|
||||
assert canonical.repos == ["a", "b"]
|
||||
assert compatibility.agent_command == "claude"
|
||||
assert compatibility.initial_command == "claude"
|
||||
assert neutral.initial_command is None
|
||||
|
||||
|
||||
def test_repository_first_and_command_first_start_shorthand():
|
||||
assert normalize_argv(["flex-auth", "audit-core"]) == [
|
||||
"start",
|
||||
"flex-auth",
|
||||
"audit-core",
|
||||
]
|
||||
assert normalize_argv(["--command", "codex", "flex-auth"]) == [
|
||||
"start",
|
||||
"--command",
|
||||
"codex",
|
||||
"flex-auth",
|
||||
]
|
||||
assert normalize_argv(["status"]) == ["status"]
|
||||
assert normalize_argv(["--verbose", "flex-auth", "audit-core"]) == [
|
||||
"--verbose",
|
||||
"start",
|
||||
"flex-auth",
|
||||
"audit-core",
|
||||
]
|
||||
|
||||
|
||||
def test_detached_no_service_start_skips_socket_registration(monkeypatch, capsys):
|
||||
|
|
@ -54,7 +77,7 @@ def test_detached_no_service_start_skips_socket_registration(monkeypatch, capsys
|
|||
class Manager:
|
||||
def preflight(self, repos, command):
|
||||
assert repos == ["a", "b"]
|
||||
assert command == "codex"
|
||||
assert command is None
|
||||
return "plan"
|
||||
|
||||
def ensure_plan(self, plan, *, tap=True):
|
||||
|
|
@ -121,7 +144,7 @@ def test_registration_failure_rolls_back_created_windows(monkeypatch, capsys):
|
|||
return "plan"
|
||||
|
||||
def ensure_plan(self, plan, *, tap=True):
|
||||
assert tap is True
|
||||
assert tap is False
|
||||
return endpoint
|
||||
|
||||
def rollback(self, value):
|
||||
|
|
@ -132,8 +155,15 @@ def test_registration_failure_rolls_back_created_windows(monkeypatch, capsys):
|
|||
|
||||
monkeypatch.setattr("tamq.cli.TmuxManager", Manager)
|
||||
monkeypatch.setattr("tamq.cli.preflight_runtime_paths", lambda: None)
|
||||
monkeypatch.setattr("tamq.cli.ensure_service", lambda: True)
|
||||
monkeypatch.setattr("tamq.cli.ensure_manual_service", lambda: True)
|
||||
monkeypatch.setattr("tamq.cli.request", failed_registration)
|
||||
assert main(["start", "--detach", "a"]) == 1
|
||||
assert rolled_back == [endpoint]
|
||||
assert "endpoint registration failed: denied" in capsys.readouterr().err
|
||||
|
||||
|
||||
def test_tap_requires_explicit_command_and_service(capsys):
|
||||
assert main(["start", "--tap", "a"]) == 2
|
||||
assert "--tap requires an explicit --command" in capsys.readouterr().err
|
||||
assert main(["start", "--tap", "--no-service", "--command", "sh", "a"]) == 2
|
||||
assert "--tap cannot be combined with --no-service" in capsys.readouterr().err
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue