Keep run-once timeout flag distinct
This commit is contained in:
@@ -216,6 +216,20 @@ class TestRunOnceCommand:
|
||||
|
||||
assert call_provider.call_args.args[1] == "Summarize this\n\ndocument body"
|
||||
|
||||
def test_timeout_reaches_provider_call(self):
|
||||
result = SimpleNamespace(success=True, text="ok", error=None)
|
||||
with (
|
||||
patch('sys.argv', [
|
||||
'cmdforge', 'run-once', 'hello', '--provider', 'mock',
|
||||
'--timeout', '145',
|
||||
]),
|
||||
patch('sys.stdin', StringIO()),
|
||||
patch('cmdforge.providers.call_provider', return_value=result) as call_provider,
|
||||
):
|
||||
assert main() == 0
|
||||
|
||||
assert call_provider.call_args.kwargs["timeout"] == 145
|
||||
|
||||
def test_uses_configured_default_provider(self):
|
||||
result = SimpleNamespace(success=True, text="ok", error=None)
|
||||
config = SimpleNamespace(default_provider="configured-provider")
|
||||
@@ -294,6 +308,42 @@ class TestRunOnceCommand:
|
||||
assert call["fallback_used"] is False
|
||||
|
||||
|
||||
class TestRunCommand:
|
||||
def test_provider_timeout_reaches_prompt_step_provider_call(self):
|
||||
from cmdforge.providers import ProviderResult
|
||||
|
||||
tool = Tool(
|
||||
name="timeout-tool",
|
||||
steps=[PromptStep(
|
||||
prompt="Process {input}",
|
||||
provider="mock",
|
||||
output_var="result",
|
||||
plain_text=True,
|
||||
timeout=900,
|
||||
)],
|
||||
output="{result}",
|
||||
)
|
||||
stdin = MagicMock()
|
||||
stdin.isatty.return_value = True
|
||||
with (
|
||||
patch('sys.argv', [
|
||||
'cmdforge', 'run', 'timeout-tool', '--provider-timeout', '145',
|
||||
]),
|
||||
patch('sys.stdin', stdin),
|
||||
patch(
|
||||
'cmdforge.cli.tool_commands._resolve_existing_tool',
|
||||
return_value=tool,
|
||||
),
|
||||
patch(
|
||||
'cmdforge.runner.call_provider',
|
||||
return_value=ProviderResult(text="ok", success=True),
|
||||
) as call_provider,
|
||||
):
|
||||
assert main() == 0
|
||||
|
||||
assert call_provider.call_args.kwargs["timeout"] == 145
|
||||
|
||||
|
||||
class TestCreateCommand:
|
||||
"""Tests for 'cmdforge create' command."""
|
||||
|
||||
|
||||
Reference in New Issue
Block a user