Some checks failed
Release / semantic-release (push) Successful in 59s
tests / Unit tests (Linux, Python 3.11) (push) Successful in 13m45s
Release / build-linux (push) Failing after 7m47s
Release / build-windows (push) Has been cancelled
Release / build-macos (arm64, macos-latest) (push) Has been cancelled
Release / build-macos (x64, macos-15-intel) (push) Has been cancelled
Release / release-main (push) Has been cancelled
Release / release-develop (push) Has been cancelled
Transform isair/jarvis into a Discord-controlled voice assistant running on the Ubuntu VNC desktop, keeping the mature ~39k-line Python brain intact. - bot/ (Node + bun, discord.js): /자비스 slash commands (ephemeral), voice channel join + voice receive/playback, pluggable VNC screen broadcast (selfbot live / noVNC / screenshot) - bridge/ (Python, Flask): wraps jarvis STT + run_reply_engine + Piper TTS behind a thin localhost HTTP API - .env.example, scripts/ (start_bridge/start_bot/dev), README rewrite, docs/language-comparison.md and docs/vnc-xfce-setup.md Language decision: hybrid (Python brain + Node/bun Discord layer) because Discord blocks bot video; native screen broadcast only works via a Node selfbot library.
69 lines
2.4 KiB
Python
69 lines
2.4 KiB
Python
"""Tests for stop tool."""
|
|
|
|
import pytest
|
|
from unittest.mock import Mock
|
|
|
|
from src.jarvis.tools.builtin.stop import StopTool, STOP_SIGNAL
|
|
from src.jarvis.tools.base import ToolContext
|
|
from src.jarvis.tools.types import ToolExecutionResult
|
|
|
|
|
|
class TestStopTool:
|
|
"""Test stop tool functionality."""
|
|
|
|
def setup_method(self):
|
|
"""Set up test fixtures."""
|
|
self.tool = StopTool()
|
|
self.context = Mock(spec=ToolContext)
|
|
self.context.user_print = Mock()
|
|
|
|
def test_tool_properties(self):
|
|
"""Test tool metadata properties."""
|
|
assert self.tool.name == "stop"
|
|
assert "end" in self.tool.description.lower()
|
|
assert "conversation" in self.tool.description.lower()
|
|
assert self.tool.inputSchema["type"] == "object"
|
|
assert self.tool.inputSchema["required"] == []
|
|
assert self.tool.inputSchema["properties"] == {}
|
|
|
|
def test_run_returns_stop_signal(self):
|
|
"""Test that run returns the special stop signal."""
|
|
result = self.tool.run({}, self.context)
|
|
|
|
assert isinstance(result, ToolExecutionResult)
|
|
assert result.success is True
|
|
assert result.reply_text == STOP_SIGNAL
|
|
assert result.error_message is None
|
|
|
|
def test_run_with_none_args(self):
|
|
"""Test that run works with None args."""
|
|
result = self.tool.run(None, self.context)
|
|
|
|
assert isinstance(result, ToolExecutionResult)
|
|
assert result.success is True
|
|
assert result.reply_text == STOP_SIGNAL
|
|
|
|
def test_stop_signal_is_unique(self):
|
|
"""Test that stop signal is a unique value unlikely to be confused with real content."""
|
|
assert STOP_SIGNAL.startswith("__")
|
|
assert STOP_SIGNAL.endswith("__")
|
|
assert "JARVIS" in STOP_SIGNAL
|
|
assert "STOP" in STOP_SIGNAL
|
|
|
|
|
|
class TestStopSignalIntegration:
|
|
"""Test stop signal integration with registry."""
|
|
|
|
def test_stop_tool_in_registry(self):
|
|
"""Test that stop tool is registered in BUILTIN_TOOLS."""
|
|
from src.jarvis.tools.registry import BUILTIN_TOOLS
|
|
|
|
assert "stop" in BUILTIN_TOOLS
|
|
assert isinstance(BUILTIN_TOOLS["stop"], StopTool)
|
|
|
|
def test_stop_tool_always_available(self):
|
|
"""Test that stop tool is available to all profiles via BUILTIN_TOOLS."""
|
|
from src.jarvis.tools.registry import BUILTIN_TOOLS
|
|
|
|
assert "stop" in BUILTIN_TOOLS, "stop tool must be in BUILTIN_TOOLS"
|