Compare commits

..

No commits in common. "4569af4b8ccf2bafd10a32b470e461995100d641" and "f061457529ef27b95df1cfa5262385203b380754" have entirely different histories.

21 changed files with 148 additions and 188 deletions

View File

@ -12,7 +12,7 @@ jobs:
strategy: strategy:
matrix: matrix:
os: [ubuntu-latest, macos-latest, windows-latest] os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ['3.10', '3.11', '3.12'] python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4

View File

@ -12,46 +12,6 @@
## Version 1.19.0 - 2025-11-07
This release updates the project's version number. No new features or changes are introduced for users or developers.
**Changes:** 1 files, 2 lines
**Languages:** TOML (2 lines)
## Version 1.18.0 - 2025-11-07
The project has been updated to version 1.18.0. Release notes detailing changes are now available in the CHANGELOG.
**Changes:** 2 files, 10 lines
**Languages:** Markdown (8 lines), TOML (2 lines)
## Version 1.17.0 - 2025-11-07
This release updates the project's testing environment to support newer Python versions. It also bumps the version number to 1.17.0 and includes updated release notes.
**Changes:** 3 files, 14 lines
**Languages:** Markdown (8 lines), TOML (4 lines), YAML (2 lines)
## Version 1.16.0 - 2025-11-07
This release updates the software to version 1.16.0 and cleans up internal code for better maintainability. Tests have been updated to reflect internal changes, ensuring continued functionality.
**Changes:** 20 files, 300 lines
**Languages:** Markdown (8 lines), Python (290 lines), TOML (2 lines)
## Version 1.15.0 - 2025-11-07
This release removes old, unused parts of the software. It simplifies the codebase and prepares for future improvements.
**Changes:** 2 files, 10 lines
**Languages:** Markdown (8 lines), TOML (2 lines)
## Version 1.14.0 - 2025-11-07 ## Version 1.14.0 - 2025-11-07
Several internal modules and features have been removed from the codebase. This simplifies the project and removes functionality that was no longer in use. Several internal modules and features have been removed from the codebase. This simplifies the project and removes functionality that was no longer in use.

View File

@ -4,10 +4,10 @@ build-backend = "setuptools.build_meta"
[project] [project]
name = "rp" name = "rp"
version = "1.18.0" version = "1.14.0"
description = "R python edition. The ultimate autonomous AI CLI." description = "R python edition. The ultimate autonomous AI CLI."
readme = "README.md" readme = "README.md"
requires-python = ">=3.10" requires-python = ">=3.12"
license = {text = "MIT"} license = {text = "MIT"}
keywords = ["ai", "assistant", "cli", "automation", "openrouter", "autonomous"] keywords = ["ai", "assistant", "cli", "automation", "openrouter", "autonomous"]
authors = [ authors = [

View File

@ -1,7 +1,7 @@
import unittest import unittest
from unittest.mock import MagicMock, patch from unittest.mock import MagicMock, patch
from rp.core.assistant import Assistant, process_message from pr.core.assistant import Assistant, process_message
class TestAssistant(unittest.TestCase): class TestAssistant(unittest.TestCase):
@ -17,8 +17,8 @@ class TestAssistant(unittest.TestCase):
@patch("sqlite3.connect") @patch("sqlite3.connect")
@patch("os.environ.get") @patch("os.environ.get")
@patch("rp.core.context.init_system_message") @patch("pr.core.context.init_system_message")
@patch("rp.core.enhanced_assistant.EnhancedAssistant") @patch("pr.core.enhanced_assistant.EnhancedAssistant")
def test_init(self, mock_enhanced, mock_init_sys, mock_env, mock_sqlite): def test_init(self, mock_enhanced, mock_init_sys, mock_env, mock_sqlite):
mock_env.side_effect = lambda key, default: { mock_env.side_effect = lambda key, default: {
"OPENROUTER_API_KEY": "key", "OPENROUTER_API_KEY": "key",
@ -38,8 +38,8 @@ class TestAssistant(unittest.TestCase):
self.assertEqual(assistant.model, "test-model") self.assertEqual(assistant.model, "test-model")
mock_sqlite.assert_called_once() mock_sqlite.assert_called_once()
@patch("rp.core.assistant.call_api") @patch("pr.core.assistant.call_api")
@patch("rp.core.assistant.render_markdown") @patch("pr.core.assistant.render_markdown")
def test_process_response_no_tools(self, mock_render, mock_call): def test_process_response_no_tools(self, mock_render, mock_call):
assistant = MagicMock() assistant = MagicMock()
assistant.verbose = False assistant.verbose = False
@ -53,9 +53,9 @@ class TestAssistant(unittest.TestCase):
self.assertEqual(result, "rendered") self.assertEqual(result, "rendered")
assistant.messages.append.assert_called_with({"content": "content"}) assistant.messages.append.assert_called_with({"content": "content"})
@patch("rp.core.assistant.call_api") @patch("pr.core.assistant.call_api")
@patch("rp.core.assistant.render_markdown") @patch("pr.core.assistant.render_markdown")
@patch("rp.core.assistant.get_tools_definition") @patch("pr.core.assistant.get_tools_definition")
def test_process_response_with_tools(self, mock_tools_def, mock_render, mock_call): def test_process_response_with_tools(self, mock_tools_def, mock_render, mock_call):
assistant = MagicMock() assistant = MagicMock()
assistant.verbose = False assistant.verbose = False
@ -86,8 +86,8 @@ class TestAssistant(unittest.TestCase):
mock_call.assert_called() mock_call.assert_called()
@patch("rp.core.assistant.call_api") @patch("pr.core.assistant.call_api")
@patch("rp.core.assistant.get_tools_definition") @patch("pr.core.assistant.get_tools_definition")
def test_process_message(self, mock_tools, mock_call): def test_process_message(self, mock_tools, mock_call):
assistant = MagicMock() assistant = MagicMock()
assistant.verbose = False assistant.verbose = False
@ -98,7 +98,7 @@ class TestAssistant(unittest.TestCase):
mock_tools.return_value = [] mock_tools.return_value = []
mock_call.return_value = {"choices": [{"message": {"content": "response"}}]} mock_call.return_value = {"choices": [{"message": {"content": "response"}}]}
with patch("rp.core.assistant.render_markdown", return_value="rendered"): with patch("pr.core.assistant.render_markdown", return_value="rendered"):
with patch("builtins.print"): with patch("builtins.print"):
process_message(assistant, "test message") process_message(assistant, "test message")

View File

@ -1,5 +1,5 @@
from unittest.mock import Mock, patch from unittest.mock import Mock, patch
from rp.commands.handlers import ( from pr.commands.handlers import (
handle_command, handle_command,
review_file, review_file,
refactor_file, refactor_file,
@ -35,9 +35,9 @@ class TestHandleCommand:
self.assistant.model_list_url = "http://test.com" self.assistant.model_list_url = "http://test.com"
self.assistant.api_key = "test-key" self.assistant.api_key = "test-key"
@patch("rp.commands.handlers.run_autonomous_mode") @patch("pr.commands.handlers.run_autonomous_mode")
def test_handle_edit(self, mock_run): def test_handle_edit(self, mock_run):
with patch("rp.commands.handlers.RPEditor") as mock_editor: with patch("pr.commands.handlers.RPEditor") as mock_editor:
mock_editor_instance = Mock() mock_editor_instance = Mock()
mock_editor.return_value = mock_editor_instance mock_editor.return_value = mock_editor_instance
mock_editor_instance.get_text.return_value = "test task" mock_editor_instance.get_text.return_value = "test task"
@ -48,7 +48,7 @@ class TestHandleCommand:
mock_run.assert_called_once_with(self.assistant, "test task") mock_run.assert_called_once_with(self.assistant, "test task")
mock_editor_instance.stop.assert_called_once() mock_editor_instance.stop.assert_called_once()
@patch("rp.commands.handlers.run_autonomous_mode") @patch("pr.commands.handlers.run_autonomous_mode")
def test_handle_auto(self, mock_run): def test_handle_auto(self, mock_run):
result = handle_command(self.assistant, "/auto test task") result = handle_command(self.assistant, "/auto test task")
assert result is True assert result is True
@ -62,14 +62,14 @@ class TestHandleCommand:
result = handle_command(self.assistant, "exit") result = handle_command(self.assistant, "exit")
assert result is False assert result is False
@patch("rp.commands.help_docs.get_full_help") @patch("pr.commands.help_docs.get_full_help")
def test_handle_help(self, mock_help): def test_handle_help(self, mock_help):
mock_help.return_value = "full help" mock_help.return_value = "full help"
result = handle_command(self.assistant, "/help") result = handle_command(self.assistant, "/help")
assert result is True assert result is True
mock_help.assert_called_once() mock_help.assert_called_once()
@patch("rp.commands.help_docs.get_workflow_help") @patch("pr.commands.help_docs.get_workflow_help")
def test_handle_help_workflows(self, mock_help): def test_handle_help_workflows(self, mock_help):
mock_help.return_value = "workflow help" mock_help.return_value = "workflow help"
result = handle_command(self.assistant, "/help workflows") result = handle_command(self.assistant, "/help workflows")
@ -103,57 +103,57 @@ class TestHandleCommand:
assert result is True assert result is True
assert self.assistant.model == "new-model" assert self.assistant.model == "new-model"
@patch("rp.commands.handlers.list_models") @patch("pr.commands.handlers.list_models")
def test_handle_models(self, mock_list): def test_handle_models(self, mock_list):
mock_list.return_value = [{"id": "model1"}, {"id": "model2"}] mock_list.return_value = [{"id": "model1"}, {"id": "model2"}]
result = handle_command(self.assistant, "/models") result = handle_command(self.assistant, "/models")
assert result is True assert result is True
mock_list.assert_called_once_with("http://test.com", "test-key") mock_list.assert_called_once_with("http://test.com", "test-key")
@patch("rp.commands.handlers.list_models") @patch("pr.commands.handlers.list_models")
def test_handle_models_error(self, mock_list): def test_handle_models_error(self, mock_list):
mock_list.return_value = {"error": "test error"} mock_list.return_value = {"error": "test error"}
result = handle_command(self.assistant, "/models") result = handle_command(self.assistant, "/models")
assert result is True assert result is True
@patch("rp.commands.handlers.get_tools_definition") @patch("pr.commands.handlers.get_tools_definition")
def test_handle_tools(self, mock_tools): def test_handle_tools(self, mock_tools):
mock_tools.return_value = [{"function": {"name": "tool1", "description": "desc"}}] mock_tools.return_value = [{"function": {"name": "tool1", "description": "desc"}}]
result = handle_command(self.assistant, "/tools") result = handle_command(self.assistant, "/tools")
assert result is True assert result is True
mock_tools.assert_called_once() mock_tools.assert_called_once()
@patch("rp.commands.handlers.review_file") @patch("pr.commands.handlers.review_file")
def test_handle_review(self, mock_review): def test_handle_review(self, mock_review):
result = handle_command(self.assistant, "/review test.py") result = handle_command(self.assistant, "/review test.py")
assert result is True assert result is True
mock_review.assert_called_once_with(self.assistant, "test.py") mock_review.assert_called_once_with(self.assistant, "test.py")
@patch("rp.commands.handlers.refactor_file") @patch("pr.commands.handlers.refactor_file")
def test_handle_refactor(self, mock_refactor): def test_handle_refactor(self, mock_refactor):
result = handle_command(self.assistant, "/refactor test.py") result = handle_command(self.assistant, "/refactor test.py")
assert result is True assert result is True
mock_refactor.assert_called_once_with(self.assistant, "test.py") mock_refactor.assert_called_once_with(self.assistant, "test.py")
@patch("rp.commands.handlers.obfuscate_file") @patch("pr.commands.handlers.obfuscate_file")
def test_handle_obfuscate(self, mock_obfuscate): def test_handle_obfuscate(self, mock_obfuscate):
result = handle_command(self.assistant, "/obfuscate test.py") result = handle_command(self.assistant, "/obfuscate test.py")
assert result is True assert result is True
mock_obfuscate.assert_called_once_with(self.assistant, "test.py") mock_obfuscate.assert_called_once_with(self.assistant, "test.py")
@patch("rp.commands.handlers.show_workflows") @patch("pr.commands.handlers.show_workflows")
def test_handle_workflows(self, mock_show): def test_handle_workflows(self, mock_show):
result = handle_command(self.assistant, "/workflows") result = handle_command(self.assistant, "/workflows")
assert result is True assert result is True
mock_show.assert_called_once_with(self.assistant) mock_show.assert_called_once_with(self.assistant)
@patch("rp.commands.handlers.execute_workflow_command") @patch("pr.commands.handlers.execute_workflow_command")
def test_handle_workflow(self, mock_exec): def test_handle_workflow(self, mock_exec):
result = handle_command(self.assistant, "/workflow test") result = handle_command(self.assistant, "/workflow test")
assert result is True assert result is True
mock_exec.assert_called_once_with(self.assistant, "test") mock_exec.assert_called_once_with(self.assistant, "test")
@patch("rp.commands.handlers.execute_agent_task") @patch("pr.commands.handlers.execute_agent_task")
def test_handle_agent(self, mock_exec): def test_handle_agent(self, mock_exec):
result = handle_command(self.assistant, "/agent coding test task") result = handle_command(self.assistant, "/agent coding test task")
assert result is True assert result is True
@ -163,55 +163,55 @@ class TestHandleCommand:
result = handle_command(self.assistant, "/agent") result = handle_command(self.assistant, "/agent")
assert result is True assert result is True
@patch("rp.commands.handlers.show_agents") @patch("pr.commands.handlers.show_agents")
def test_handle_agents(self, mock_show): def test_handle_agents(self, mock_show):
result = handle_command(self.assistant, "/agents") result = handle_command(self.assistant, "/agents")
assert result is True assert result is True
mock_show.assert_called_once_with(self.assistant) mock_show.assert_called_once_with(self.assistant)
@patch("rp.commands.handlers.collaborate_agents_command") @patch("pr.commands.handlers.collaborate_agents_command")
def test_handle_collaborate(self, mock_collab): def test_handle_collaborate(self, mock_collab):
result = handle_command(self.assistant, "/collaborate test task") result = handle_command(self.assistant, "/collaborate test task")
assert result is True assert result is True
mock_collab.assert_called_once_with(self.assistant, "test task") mock_collab.assert_called_once_with(self.assistant, "test task")
@patch("rp.commands.handlers.search_knowledge") @patch("pr.commands.handlers.search_knowledge")
def test_handle_knowledge(self, mock_search): def test_handle_knowledge(self, mock_search):
result = handle_command(self.assistant, "/knowledge test query") result = handle_command(self.assistant, "/knowledge test query")
assert result is True assert result is True
mock_search.assert_called_once_with(self.assistant, "test query") mock_search.assert_called_once_with(self.assistant, "test query")
@patch("rp.commands.handlers.store_knowledge") @patch("pr.commands.handlers.store_knowledge")
def test_handle_remember(self, mock_store): def test_handle_remember(self, mock_store):
result = handle_command(self.assistant, "/remember test content") result = handle_command(self.assistant, "/remember test content")
assert result is True assert result is True
mock_store.assert_called_once_with(self.assistant, "test content") mock_store.assert_called_once_with(self.assistant, "test content")
@patch("rp.commands.handlers.show_conversation_history") @patch("pr.commands.handlers.show_conversation_history")
def test_handle_history(self, mock_show): def test_handle_history(self, mock_show):
result = handle_command(self.assistant, "/history") result = handle_command(self.assistant, "/history")
assert result is True assert result is True
mock_show.assert_called_once_with(self.assistant) mock_show.assert_called_once_with(self.assistant)
@patch("rp.commands.handlers.show_cache_stats") @patch("pr.commands.handlers.show_cache_stats")
def test_handle_cache(self, mock_show): def test_handle_cache(self, mock_show):
result = handle_command(self.assistant, "/cache") result = handle_command(self.assistant, "/cache")
assert result is True assert result is True
mock_show.assert_called_once_with(self.assistant) mock_show.assert_called_once_with(self.assistant)
@patch("rp.commands.handlers.clear_caches") @patch("pr.commands.handlers.clear_caches")
def test_handle_cache_clear(self, mock_clear): def test_handle_cache_clear(self, mock_clear):
result = handle_command(self.assistant, "/cache clear") result = handle_command(self.assistant, "/cache clear")
assert result is True assert result is True
mock_clear.assert_called_once_with(self.assistant) mock_clear.assert_called_once_with(self.assistant)
@patch("rp.commands.handlers.show_system_stats") @patch("pr.commands.handlers.show_system_stats")
def test_handle_stats(self, mock_show): def test_handle_stats(self, mock_show):
result = handle_command(self.assistant, "/stats") result = handle_command(self.assistant, "/stats")
assert result is True assert result is True
mock_show.assert_called_once_with(self.assistant) mock_show.assert_called_once_with(self.assistant)
@patch("rp.commands.handlers.handle_background_command") @patch("pr.commands.handlers.handle_background_command")
def test_handle_bg(self, mock_bg): def test_handle_bg(self, mock_bg):
result = handle_command(self.assistant, "/bg list") result = handle_command(self.assistant, "/bg list")
assert result is True assert result is True
@ -226,8 +226,8 @@ class TestReviewFile:
def setup_method(self): def setup_method(self):
self.assistant = Mock() self.assistant = Mock()
@patch("rp.commands.handlers.read_file") @patch("pr.commands.handlers.read_file")
@patch("rp.core.assistant.process_message") @patch("pr.core.assistant.process_message")
@patch("asyncio.create_task") @patch("asyncio.create_task")
async def test_review_file_success(self, mock_create_task, mock_process, mock_read): async def test_review_file_success(self, mock_create_task, mock_process, mock_read):
mock_read.return_value = {"status": "success", "content": "test content"} mock_read.return_value = {"status": "success", "content": "test content"}
@ -237,7 +237,7 @@ class TestReviewFile:
args = mock_process.call_args[0] args = mock_process.call_args[0]
assert "Please review this file" in args[1] assert "Please review this file" in args[1]
@patch("rp.commands.handlers.read_file") @patch("pr.commands.handlers.read_file")
def test_review_file_error(self, mock_read): def test_review_file_error(self, mock_read):
mock_read.return_value = {"status": "error", "error": "file not found"} mock_read.return_value = {"status": "error", "error": "file not found"}
review_file(self.assistant, "test.py") review_file(self.assistant, "test.py")
@ -248,8 +248,8 @@ class TestRefactorFile:
def setup_method(self): def setup_method(self):
self.assistant = Mock() self.assistant = Mock()
@patch("rp.commands.handlers.read_file") @patch("pr.commands.handlers.read_file")
@patch("rp.core.assistant.process_message") @patch("pr.core.assistant.process_message")
def test_refactor_file_success(self, mock_process, mock_read): def test_refactor_file_success(self, mock_process, mock_read):
mock_read.return_value = {"status": "success", "content": "test content"} mock_read.return_value = {"status": "success", "content": "test content"}
refactor_file(self.assistant, "test.py") refactor_file(self.assistant, "test.py")
@ -257,7 +257,7 @@ class TestRefactorFile:
args = mock_process.call_args[0] args = mock_process.call_args[0]
assert "Please refactor this code" in args[1] assert "Please refactor this code" in args[1]
@patch("rp.commands.handlers.read_file") @patch("pr.commands.handlers.read_file")
def test_refactor_file_error(self, mock_read): def test_refactor_file_error(self, mock_read):
mock_read.return_value = {"status": "error", "error": "file not found"} mock_read.return_value = {"status": "error", "error": "file not found"}
refactor_file(self.assistant, "test.py") refactor_file(self.assistant, "test.py")
@ -267,8 +267,8 @@ class TestObfuscateFile:
def setup_method(self): def setup_method(self):
self.assistant = Mock() self.assistant = Mock()
@patch("rp.commands.handlers.read_file") @patch("pr.commands.handlers.read_file")
@patch("rp.core.assistant.process_message") @patch("pr.core.assistant.process_message")
def test_obfuscate_file_success(self, mock_process, mock_read): def test_obfuscate_file_success(self, mock_process, mock_read):
mock_read.return_value = {"status": "success", "content": "test content"} mock_read.return_value = {"status": "success", "content": "test content"}
obfuscate_file(self.assistant, "test.py") obfuscate_file(self.assistant, "test.py")
@ -276,7 +276,7 @@ class TestObfuscateFile:
args = mock_process.call_args[0] args = mock_process.call_args[0]
assert "Please obfuscate this code" in args[1] assert "Please obfuscate this code" in args[1]
@patch("rp.commands.handlers.read_file") @patch("pr.commands.handlers.read_file")
def test_obfuscate_file_error(self, mock_read): def test_obfuscate_file_error(self, mock_read):
mock_read.return_value = {"status": "error", "error": "file not found"} mock_read.return_value = {"status": "error", "error": "file not found"}
obfuscate_file(self.assistant, "test.py") obfuscate_file(self.assistant, "test.py")
@ -411,7 +411,7 @@ class TestStoreKnowledge:
delattr(self.assistant, "enhanced") delattr(self.assistant, "enhanced")
store_knowledge(self.assistant, "content") store_knowledge(self.assistant, "content")
@patch("rp.memory.KnowledgeEntry") @patch("pr.memory.KnowledgeEntry")
def test_store_knowledge_success(self, mock_entry): def test_store_knowledge_success(self, mock_entry):
self.assistant.enhanced = Mock() self.assistant.enhanced = Mock()
self.assistant.enhanced.fact_extractor.categorize_content.return_value = ["general"] self.assistant.enhanced.fact_extractor.categorize_content.return_value = ["general"]
@ -520,31 +520,31 @@ class TestHandleBackgroundCommand:
def test_handle_bg_no_args(self): def test_handle_bg_no_args(self):
handle_background_command(self.assistant, "/bg") handle_background_command(self.assistant, "/bg")
@patch("rp.commands.handlers.start_background_session") @patch("pr.commands.handlers.start_background_session")
def test_handle_bg_start(self, mock_start): def test_handle_bg_start(self, mock_start):
handle_background_command(self.assistant, "/bg start ls -la") handle_background_command(self.assistant, "/bg start ls -la")
@patch("rp.commands.handlers.list_background_sessions") @patch("pr.commands.handlers.list_background_sessions")
def test_handle_bg_list(self, mock_list): def test_handle_bg_list(self, mock_list):
handle_background_command(self.assistant, "/bg list") handle_background_command(self.assistant, "/bg list")
@patch("rp.commands.handlers.show_session_status") @patch("pr.commands.handlers.show_session_status")
def test_handle_bg_status(self, mock_status): def test_handle_bg_status(self, mock_status):
handle_background_command(self.assistant, "/bg status session1") handle_background_command(self.assistant, "/bg status session1")
@patch("rp.commands.handlers.show_session_output") @patch("pr.commands.handlers.show_session_output")
def test_handle_bg_output(self, mock_output): def test_handle_bg_output(self, mock_output):
handle_background_command(self.assistant, "/bg output session1") handle_background_command(self.assistant, "/bg output session1")
@patch("rp.commands.handlers.send_session_input") @patch("pr.commands.handlers.send_session_input")
def test_handle_bg_input(self, mock_input): def test_handle_bg_input(self, mock_input):
handle_background_command(self.assistant, "/bg input session1 test input") handle_background_command(self.assistant, "/bg input session1 test input")
@patch("rp.commands.handlers.kill_background_session") @patch("pr.commands.handlers.kill_background_session")
def test_handle_bg_kill(self, mock_kill): def test_handle_bg_kill(self, mock_kill):
handle_background_command(self.assistant, "/bg kill session1") handle_background_command(self.assistant, "/bg kill session1")
@patch("rp.commands.handlers.show_background_events") @patch("pr.commands.handlers.show_background_events")
def test_handle_bg_events(self, mock_events): def test_handle_bg_events(self, mock_events):
handle_background_command(self.assistant, "/bg events") handle_background_command(self.assistant, "/bg events")
@ -556,17 +556,17 @@ class TestStartBackgroundSession:
def setup_method(self): def setup_method(self):
self.assistant = Mock() self.assistant = Mock()
@patch("rp.multiplexer.start_background_process") @patch("pr.multiplexer.start_background_process")
def test_start_background_success(self, mock_start): def test_start_background_success(self, mock_start):
mock_start.return_value = {"status": "success", "pid": 123} mock_start.return_value = {"status": "success", "pid": 123}
start_background_session(self.assistant, "session1", "ls -la") start_background_session(self.assistant, "session1", "ls -la")
@patch("rp.multiplexer.start_background_process") @patch("pr.multiplexer.start_background_process")
def test_start_background_error(self, mock_start): def test_start_background_error(self, mock_start):
mock_start.return_value = {"status": "error", "error": "failed"} mock_start.return_value = {"status": "error", "error": "failed"}
start_background_session(self.assistant, "session1", "ls -la") start_background_session(self.assistant, "session1", "ls -la")
@patch("rp.multiplexer.start_background_process") @patch("pr.multiplexer.start_background_process")
def test_start_background_exception(self, mock_start): def test_start_background_exception(self, mock_start):
mock_start.side_effect = Exception("test") mock_start.side_effect = Exception("test")
start_background_session(self.assistant, "session1", "ls -la") start_background_session(self.assistant, "session1", "ls -la")
@ -576,13 +576,13 @@ class TestListBackgroundSessions:
def setup_method(self): def setup_method(self):
self.assistant = Mock() self.assistant = Mock()
@patch("rp.multiplexer.get_all_sessions") @patch("pr.multiplexer.get_all_sessions")
@patch("rp.ui.display.display_multiplexer_status") @patch("pr.ui.display.display_multiplexer_status")
def test_list_sessions_success(self, mock_display, mock_get): def test_list_sessions_success(self, mock_display, mock_get):
mock_get.return_value = {} mock_get.return_value = {}
list_background_sessions(self.assistant) list_background_sessions(self.assistant)
@patch("rp.multiplexer.get_all_sessions") @patch("pr.multiplexer.get_all_sessions")
def test_list_sessions_exception(self, mock_get): def test_list_sessions_exception(self, mock_get):
mock_get.side_effect = Exception("test") mock_get.side_effect = Exception("test")
list_background_sessions(self.assistant) list_background_sessions(self.assistant)
@ -592,7 +592,7 @@ class TestShowSessionStatus:
def setup_method(self): def setup_method(self):
self.assistant = Mock() self.assistant = Mock()
@patch("rp.multiplexer.get_session_info") @patch("pr.multiplexer.get_session_info")
def test_show_status_found(self, mock_get): def test_show_status_found(self, mock_get):
mock_get.return_value = { mock_get.return_value = {
"status": "running", "status": "running",
@ -602,12 +602,12 @@ class TestShowSessionStatus:
} }
show_session_status(self.assistant, "session1") show_session_status(self.assistant, "session1")
@patch("rp.multiplexer.get_session_info") @patch("pr.multiplexer.get_session_info")
def test_show_status_not_found(self, mock_get): def test_show_status_not_found(self, mock_get):
mock_get.return_value = None mock_get.return_value = None
show_session_status(self.assistant, "session1") show_session_status(self.assistant, "session1")
@patch("rp.multiplexer.get_session_info") @patch("pr.multiplexer.get_session_info")
def test_show_status_exception(self, mock_get): def test_show_status_exception(self, mock_get):
mock_get.side_effect = Exception("test") mock_get.side_effect = Exception("test")
show_session_status(self.assistant, "session1") show_session_status(self.assistant, "session1")
@ -617,17 +617,17 @@ class TestShowSessionOutput:
def setup_method(self): def setup_method(self):
self.assistant = Mock() self.assistant = Mock()
@patch("rp.multiplexer.get_session_output") @patch("pr.multiplexer.get_session_output")
def test_show_output_success(self, mock_get): def test_show_output_success(self, mock_get):
mock_get.return_value = ["line1", "line2"] mock_get.return_value = ["line1", "line2"]
show_session_output(self.assistant, "session1") show_session_output(self.assistant, "session1")
@patch("rp.multiplexer.get_session_output") @patch("pr.multiplexer.get_session_output")
def test_show_output_no_output(self, mock_get): def test_show_output_no_output(self, mock_get):
mock_get.return_value = None mock_get.return_value = None
show_session_output(self.assistant, "session1") show_session_output(self.assistant, "session1")
@patch("rp.multiplexer.get_session_output") @patch("pr.multiplexer.get_session_output")
def test_show_output_exception(self, mock_get): def test_show_output_exception(self, mock_get):
mock_get.side_effect = Exception("test") mock_get.side_effect = Exception("test")
show_session_output(self.assistant, "session1") show_session_output(self.assistant, "session1")
@ -637,17 +637,17 @@ class TestSendSessionInput:
def setup_method(self): def setup_method(self):
self.assistant = Mock() self.assistant = Mock()
@patch("rp.multiplexer.send_input_to_session") @patch("pr.multiplexer.send_input_to_session")
def test_send_input_success(self, mock_send): def test_send_input_success(self, mock_send):
mock_send.return_value = {"status": "success"} mock_send.return_value = {"status": "success"}
send_session_input(self.assistant, "session1", "input") send_session_input(self.assistant, "session1", "input")
@patch("rp.multiplexer.send_input_to_session") @patch("pr.multiplexer.send_input_to_session")
def test_send_input_error(self, mock_send): def test_send_input_error(self, mock_send):
mock_send.return_value = {"status": "error", "error": "failed"} mock_send.return_value = {"status": "error", "error": "failed"}
send_session_input(self.assistant, "session1", "input") send_session_input(self.assistant, "session1", "input")
@patch("rp.multiplexer.send_input_to_session") @patch("pr.multiplexer.send_input_to_session")
def test_send_input_exception(self, mock_send): def test_send_input_exception(self, mock_send):
mock_send.side_effect = Exception("test") mock_send.side_effect = Exception("test")
send_session_input(self.assistant, "session1", "input") send_session_input(self.assistant, "session1", "input")
@ -657,17 +657,17 @@ class TestKillBackgroundSession:
def setup_method(self): def setup_method(self):
self.assistant = Mock() self.assistant = Mock()
@patch("rp.multiplexer.kill_session") @patch("pr.multiplexer.kill_session")
def test_kill_success(self, mock_kill): def test_kill_success(self, mock_kill):
mock_kill.return_value = {"status": "success"} mock_kill.return_value = {"status": "success"}
kill_background_session(self.assistant, "session1") kill_background_session(self.assistant, "session1")
@patch("rp.multiplexer.kill_session") @patch("pr.multiplexer.kill_session")
def test_kill_error(self, mock_kill): def test_kill_error(self, mock_kill):
mock_kill.return_value = {"status": "error", "error": "failed"} mock_kill.return_value = {"status": "error", "error": "failed"}
kill_background_session(self.assistant, "session1") kill_background_session(self.assistant, "session1")
@patch("rp.multiplexer.kill_session") @patch("pr.multiplexer.kill_session")
def test_kill_exception(self, mock_kill): def test_kill_exception(self, mock_kill):
mock_kill.side_effect = Exception("test") mock_kill.side_effect = Exception("test")
kill_background_session(self.assistant, "session1") kill_background_session(self.assistant, "session1")
@ -677,22 +677,22 @@ class TestShowBackgroundEvents:
def setup_method(self): def setup_method(self):
self.assistant = Mock() self.assistant = Mock()
@patch("rp.core.background_monitor.get_global_monitor") @patch("pr.core.background_monitor.get_global_monitor")
def test_show_events_success(self, mock_get): def test_show_events_success(self, mock_get):
mock_monitor = Mock() mock_monitor = Mock()
mock_monitor.get_events.return_value = [{"event": "test"}] mock_monitor.get_events.return_value = [{"event": "test"}]
mock_get.return_value = mock_monitor mock_get.return_value = mock_monitor
with patch("rp.ui.display.display_background_event"): with patch("pr.ui.display.display_background_event"):
show_background_events(self.assistant) show_background_events(self.assistant)
@patch("rp.core.background_monitor.get_global_monitor") @patch("pr.core.background_monitor.get_global_monitor")
def test_show_events_no_events(self, mock_get): def test_show_events_no_events(self, mock_get):
mock_monitor = Mock() mock_monitor = Mock()
mock_monitor.get_events.return_value = [] mock_monitor.get_events.return_value = []
mock_get.return_value = mock_monitor mock_get.return_value = mock_monitor
show_background_events(self.assistant) show_background_events(self.assistant)
@patch("rp.core.background_monitor.get_global_monitor") @patch("pr.core.background_monitor.get_global_monitor")
def test_show_events_exception(self, mock_get): def test_show_events_exception(self, mock_get):
mock_get.side_effect = Exception("test") mock_get.side_effect = Exception("test")
show_background_events(self.assistant) show_background_events(self.assistant)

View File

@ -1,4 +1,4 @@
from rp import config from pr import config
class TestConfig: class TestConfig:

View File

@ -1,6 +1,6 @@
from unittest.mock import patch from unittest.mock import patch
from rp.core.config_loader import ( from pr.core.config_loader import (
_load_config_file, _load_config_file,
_parse_value, _parse_value,
) )

View File

@ -1,5 +1,5 @@
from rp.config import RECENT_MESSAGES_TO_KEEP from pr.config import RECENT_MESSAGES_TO_KEEP
from rp.core.context import compress_context, should_compress_context from pr.core.context import compress_context, should_compress_context
class TestContextManagement: class TestContextManagement:

View File

@ -3,7 +3,7 @@ import tempfile
import os import os
import time import time
from rp.memory.conversation_memory import ConversationMemory from pr.memory.conversation_memory import ConversationMemory
class TestConversationMemory: class TestConversationMemory:

View File

@ -1,5 +1,5 @@
import pytest import pytest
from rp.core.exceptions import ( from pr.core.exceptions import (
PRException, PRException,
APIException, APIException,
APIConnectionError, APIConnectionError,

View File

@ -1,4 +1,4 @@
from rp.memory.fact_extractor import FactExtractor from pr.memory.fact_extractor import FactExtractor
class TestFactExtractor: class TestFactExtractor:

View File

@ -1,4 +1,4 @@
from rp.commands.help_docs import ( from pr.commands.help_docs import (
get_workflow_help, get_workflow_help,
get_agent_help, get_agent_help,
get_knowledge_help, get_knowledge_help,

View File

@ -3,7 +3,7 @@ import tempfile
import os import os
import time import time
from rp.memory.knowledge_store import KnowledgeStore, KnowledgeEntry from pr.memory.knowledge_store import KnowledgeStore, KnowledgeEntry
class TestKnowledgeStore: class TestKnowledgeStore:

View File

@ -1,13 +1,13 @@
from unittest.mock import patch, MagicMock from unittest.mock import patch, MagicMock
from rp.core.logging import setup_logging, get_logger from pr.core.logging import setup_logging, get_logger
class TestLogging: class TestLogging:
@patch("rp.core.logging.os.makedirs") @patch("pr.core.logging.os.makedirs")
@patch("rp.core.logging.os.path.dirname") @patch("pr.core.logging.os.path.dirname")
@patch("rp.core.logging.os.path.exists") @patch("pr.core.logging.os.path.exists")
@patch("rp.core.logging.RotatingFileHandler") @patch("pr.core.logging.RotatingFileHandler")
@patch("rp.core.logging.logging.getLogger") @patch("pr.core.logging.logging.getLogger")
def test_setup_logging_basic( def test_setup_logging_basic(
self, mock_get_logger, mock_handler, mock_exists, mock_dirname, mock_makedirs self, mock_get_logger, mock_handler, mock_exists, mock_dirname, mock_makedirs
): ):
@ -25,12 +25,12 @@ class TestLogging:
mock_handler.assert_called_once() mock_handler.assert_called_once()
assert result == mock_logger assert result == mock_logger
@patch("rp.core.logging.os.makedirs") @patch("pr.core.logging.os.makedirs")
@patch("rp.core.logging.os.path.dirname") @patch("pr.core.logging.os.path.dirname")
@patch("rp.core.logging.os.path.exists") @patch("pr.core.logging.os.path.exists")
@patch("rp.core.logging.RotatingFileHandler") @patch("pr.core.logging.RotatingFileHandler")
@patch("rp.core.logging.logging.StreamHandler") @patch("pr.core.logging.logging.StreamHandler")
@patch("rp.core.logging.logging.getLogger") @patch("pr.core.logging.logging.getLogger")
def test_setup_logging_verbose( def test_setup_logging_verbose(
self, self,
mock_get_logger, mock_get_logger,
@ -56,7 +56,7 @@ class TestLogging:
mock_stream_handler.assert_called_once() mock_stream_handler.assert_called_once()
assert result == mock_logger assert result == mock_logger
@patch("rp.core.logging.logging.getLogger") @patch("pr.core.logging.logging.getLogger")
def test_get_logger_default(self, mock_get_logger): def test_get_logger_default(self, mock_get_logger):
mock_logger = MagicMock() mock_logger = MagicMock()
mock_get_logger.return_value = mock_logger mock_get_logger.return_value = mock_logger
@ -66,12 +66,12 @@ class TestLogging:
mock_get_logger.assert_called_once_with("pr") mock_get_logger.assert_called_once_with("pr")
assert result == mock_logger assert result == mock_logger
@patch("rp.core.logging.logging.getLogger") @patch("pr.core.logging.logging.getLogger")
def test_get_logger_named(self, mock_get_logger): def test_get_logger_named(self, mock_get_logger):
mock_logger = MagicMock() mock_logger = MagicMock()
mock_get_logger.return_value = mock_logger mock_get_logger.return_value = mock_logger
result = get_logger("test") result = get_logger("test")
mock_get_logger.assert_called_once_with("rp.test") mock_get_logger.assert_called_once_with("pr.test")
assert result == mock_logger assert result == mock_logger

View File

@ -1,5 +1,5 @@
from unittest.mock import Mock, patch from unittest.mock import Mock, patch
from rp.commands.multiplexer_commands import ( from pr.commands.multiplexer_commands import (
show_sessions, show_sessions,
attach_session, attach_session,
detach_session, detach_session,
@ -12,15 +12,15 @@ from rp.commands.multiplexer_commands import (
class TestShowSessions: class TestShowSessions:
@patch("rp.commands.multiplexer_commands.list_active_sessions") @patch("pr.commands.multiplexer_commands.list_active_sessions")
@patch("rp.commands.multiplexer_commands.get_session_status") @patch("pr.commands.multiplexer_commands.get_session_status")
def test_show_sessions_no_sessions(self, mock_status, mock_list): def test_show_sessions_no_sessions(self, mock_status, mock_list):
mock_list.return_value = {} mock_list.return_value = {}
show_sessions() show_sessions()
mock_list.assert_called_once() mock_list.assert_called_once()
@patch("rp.commands.multiplexer_commands.list_active_sessions") @patch("pr.commands.multiplexer_commands.list_active_sessions")
@patch("rp.commands.multiplexer_commands.get_session_status") @patch("pr.commands.multiplexer_commands.get_session_status")
def test_show_sessions_with_sessions(self, mock_status, mock_list): def test_show_sessions_with_sessions(self, mock_status, mock_list):
mock_list.return_value = { mock_list.return_value = {
"session1": { "session1": {
@ -43,27 +43,27 @@ class TestAttachSession:
def test_attach_session_no_args(self): def test_attach_session_no_args(self):
attach_session([]) attach_session([])
@patch("rp.commands.multiplexer_commands.get_session_status") @patch("pr.commands.multiplexer_commands.get_session_status")
def test_attach_session_not_found(self, mock_status): def test_attach_session_not_found(self, mock_status):
mock_status.return_value = None mock_status.return_value = None
attach_session(["session1"]) attach_session(["session1"])
@patch("rp.commands.multiplexer_commands.get_session_status") @patch("pr.commands.multiplexer_commands.get_session_status")
@patch("rp.commands.multiplexer_commands.read_session_output") @patch("pr.commands.multiplexer_commands.read_session_output")
def test_attach_session_success(self, mock_read, mock_status): def test_attach_session_success(self, mock_read, mock_status):
mock_status.return_value = {"is_active": True, "metadata": {"process_type": "test"}} mock_status.return_value = {"is_active": True, "metadata": {"process_type": "test"}}
mock_read.return_value = {"stdout": "line1\nline2", "stderr": ""} mock_read.return_value = {"stdout": "line1\nline2", "stderr": ""}
attach_session(["session1"]) attach_session(["session1"])
@patch("rp.commands.multiplexer_commands.get_session_status") @patch("pr.commands.multiplexer_commands.get_session_status")
@patch("rp.commands.multiplexer_commands.read_session_output") @patch("pr.commands.multiplexer_commands.read_session_output")
def test_attach_session_with_stderr(self, mock_read, mock_status): def test_attach_session_with_stderr(self, mock_read, mock_status):
mock_status.return_value = {"is_active": False, "metadata": {"process_type": "test"}} mock_status.return_value = {"is_active": False, "metadata": {"process_type": "test"}}
mock_read.return_value = {"stdout": "", "stderr": "error1\nerror2"} mock_read.return_value = {"stdout": "", "stderr": "error1\nerror2"}
attach_session(["session1"]) attach_session(["session1"])
@patch("rp.commands.multiplexer_commands.get_session_status") @patch("pr.commands.multiplexer_commands.get_session_status")
@patch("rp.commands.multiplexer_commands.read_session_output") @patch("pr.commands.multiplexer_commands.read_session_output")
def test_attach_session_read_error(self, mock_read, mock_status): def test_attach_session_read_error(self, mock_read, mock_status):
mock_status.return_value = {"is_active": True, "metadata": {"process_type": "test"}} mock_status.return_value = {"is_active": True, "metadata": {"process_type": "test"}}
mock_read.side_effect = Exception("test error") mock_read.side_effect = Exception("test error")
@ -74,12 +74,12 @@ class TestDetachSession:
def test_detach_session_no_args(self): def test_detach_session_no_args(self):
detach_session([]) detach_session([])
@patch("rp.commands.multiplexer_commands.get_multiplexer") @patch("pr.commands.multiplexer_commands.get_multiplexer")
def test_detach_session_not_found(self, mock_get): def test_detach_session_not_found(self, mock_get):
mock_get.return_value = None mock_get.return_value = None
detach_session(["session1"]) detach_session(["session1"])
@patch("rp.commands.multiplexer_commands.get_multiplexer") @patch("pr.commands.multiplexer_commands.get_multiplexer")
def test_detach_session_success(self, mock_get): def test_detach_session_success(self, mock_get):
mock_mux = Mock() mock_mux = Mock()
mock_get.return_value = mock_mux mock_get.return_value = mock_mux
@ -91,12 +91,12 @@ class TestKillSession:
def test_kill_session_no_args(self): def test_kill_session_no_args(self):
kill_session([]) kill_session([])
@patch("rp.commands.multiplexer_commands.close_interactive_session") @patch("pr.commands.multiplexer_commands.close_interactive_session")
def test_kill_session_success(self, mock_close): def test_kill_session_success(self, mock_close):
kill_session(["session1"]) kill_session(["session1"])
mock_close.assert_called_once_with("session1") mock_close.assert_called_once_with("session1")
@patch("rp.commands.multiplexer_commands.close_interactive_session") @patch("pr.commands.multiplexer_commands.close_interactive_session")
def test_kill_session_error(self, mock_close): def test_kill_session_error(self, mock_close):
mock_close.side_effect = Exception("test error") mock_close.side_effect = Exception("test error")
kill_session(["session1"]) kill_session(["session1"])
@ -109,12 +109,12 @@ class TestSendCommand:
def test_send_command_insufficient_args(self): def test_send_command_insufficient_args(self):
send_command(["session1"]) send_command(["session1"])
@patch("rp.commands.multiplexer_commands.send_input_to_session") @patch("pr.commands.multiplexer_commands.send_input_to_session")
def test_send_command_success(self, mock_send): def test_send_command_success(self, mock_send):
send_command(["session1", "ls", "-la"]) send_command(["session1", "ls", "-la"])
mock_send.assert_called_once_with("session1", "ls -la") mock_send.assert_called_once_with("session1", "ls -la")
@patch("rp.commands.multiplexer_commands.send_input_to_session") @patch("pr.commands.multiplexer_commands.send_input_to_session")
def test_send_command_error(self, mock_send): def test_send_command_error(self, mock_send):
mock_send.side_effect = Exception("test error") mock_send.side_effect = Exception("test error")
send_command(["session1", "ls"]) send_command(["session1", "ls"])
@ -124,17 +124,17 @@ class TestShowSessionLog:
def test_show_session_log_no_args(self): def test_show_session_log_no_args(self):
show_session_log([]) show_session_log([])
@patch("rp.commands.multiplexer_commands.read_session_output") @patch("pr.commands.multiplexer_commands.read_session_output")
def test_show_session_log_success(self, mock_read): def test_show_session_log_success(self, mock_read):
mock_read.return_value = {"stdout": "stdout content", "stderr": "stderr content"} mock_read.return_value = {"stdout": "stdout content", "stderr": "stderr content"}
show_session_log(["session1"]) show_session_log(["session1"])
@patch("rp.commands.multiplexer_commands.read_session_output") @patch("pr.commands.multiplexer_commands.read_session_output")
def test_show_session_log_no_stderr(self, mock_read): def test_show_session_log_no_stderr(self, mock_read):
mock_read.return_value = {"stdout": "stdout content", "stderr": ""} mock_read.return_value = {"stdout": "stdout content", "stderr": ""}
show_session_log(["session1"]) show_session_log(["session1"])
@patch("rp.commands.multiplexer_commands.read_session_output") @patch("pr.commands.multiplexer_commands.read_session_output")
def test_show_session_log_error(self, mock_read): def test_show_session_log_error(self, mock_read):
mock_read.side_effect = Exception("test error") mock_read.side_effect = Exception("test error")
show_session_log(["session1"]) show_session_log(["session1"])
@ -144,13 +144,13 @@ class TestShowSessionStatus:
def test_show_session_status_no_args(self): def test_show_session_status_no_args(self):
show_session_status([]) show_session_status([])
@patch("rp.commands.multiplexer_commands.get_session_status") @patch("pr.commands.multiplexer_commands.get_session_status")
def test_show_session_status_not_found(self, mock_status): def test_show_session_status_not_found(self, mock_status):
mock_status.return_value = None mock_status.return_value = None
show_session_status(["session1"]) show_session_status(["session1"])
@patch("rp.commands.multiplexer_commands.get_session_status") @patch("pr.commands.multiplexer_commands.get_session_status")
@patch("rp.commands.multiplexer_commands.get_global_detector") @patch("pr.commands.multiplexer_commands.get_global_detector")
def test_show_session_status_success(self, mock_detector, mock_status): def test_show_session_status_success(self, mock_detector, mock_status):
mock_status.return_value = { mock_status.return_value = {
"is_active": True, "is_active": True,
@ -172,8 +172,8 @@ class TestShowSessionStatus:
mock_detector.return_value = mock_detector_instance mock_detector.return_value = mock_detector_instance
show_session_status(["session1"]) show_session_status(["session1"])
@patch("rp.commands.multiplexer_commands.get_session_status") @patch("pr.commands.multiplexer_commands.get_session_status")
@patch("rp.commands.multiplexer_commands.get_global_detector") @patch("pr.commands.multiplexer_commands.get_global_detector")
def test_show_session_status_no_detector_info(self, mock_detector, mock_status): def test_show_session_status_no_detector_info(self, mock_detector, mock_status):
mock_status.return_value = { mock_status.return_value = {
"is_active": False, "is_active": False,
@ -193,8 +193,8 @@ class TestShowSessionStatus:
class TestListWaitingSessions: class TestListWaitingSessions:
@patch("rp.commands.multiplexer_commands.list_active_sessions") @patch("pr.commands.multiplexer_commands.list_active_sessions")
@patch("rp.commands.multiplexer_commands.get_global_detector") @patch("pr.commands.multiplexer_commands.get_global_detector")
def test_list_waiting_sessions_no_sessions(self, mock_detector, mock_list): def test_list_waiting_sessions_no_sessions(self, mock_detector, mock_list):
mock_list.return_value = {} mock_list.return_value = {}
mock_detector_instance = Mock() mock_detector_instance = Mock()
@ -202,9 +202,9 @@ class TestListWaitingSessions:
mock_detector.return_value = mock_detector_instance mock_detector.return_value = mock_detector_instance
list_waiting_sessions() list_waiting_sessions()
@patch("rp.commands.multiplexer_commands.list_active_sessions") @patch("pr.commands.multiplexer_commands.list_active_sessions")
@patch("rp.commands.multiplexer_commands.get_session_status") @patch("pr.commands.multiplexer_commands.get_session_status")
@patch("rp.commands.multiplexer_commands.get_global_detector") @patch("pr.commands.multiplexer_commands.get_global_detector")
def test_list_waiting_sessions_with_waiting(self, mock_detector, mock_status, mock_list): def test_list_waiting_sessions_with_waiting(self, mock_detector, mock_status, mock_list):
mock_list.return_value = ["session1"] mock_list.return_value = ["session1"]
mock_detector_instance = Mock() mock_detector_instance = Mock()
@ -218,8 +218,8 @@ class TestListWaitingSessions:
mock_status.return_value = {"metadata": {"process_type": "test"}} mock_status.return_value = {"metadata": {"process_type": "test"}}
list_waiting_sessions() list_waiting_sessions()
@patch("rp.commands.multiplexer_commands.list_active_sessions") @patch("pr.commands.multiplexer_commands.list_active_sessions")
@patch("rp.commands.multiplexer_commands.get_global_detector") @patch("pr.commands.multiplexer_commands.get_global_detector")
def test_list_waiting_sessions_no_waiting(self, mock_detector, mock_list): def test_list_waiting_sessions_no_waiting(self, mock_detector, mock_list):
mock_list.return_value = ["session1"] mock_list.return_value = ["session1"]
mock_detector_instance = Mock() mock_detector_instance = Mock()

View File

@ -1,6 +1,6 @@
import math import math
import pytest import pytest
from rp.memory.semantic_index import SemanticIndex from pr.memory.semantic_index import SemanticIndex
class TestSemanticIndex: class TestSemanticIndex:

View File

@ -3,12 +3,12 @@ import os
import pytest import pytest
from rp.core.session import SessionManager from pr.core.session import SessionManager
@pytest.fixture @pytest.fixture
def temp_sessions_dir(tmp_path, monkeypatch): def temp_sessions_dir(tmp_path, monkeypatch):
from rp.core import session from pr.core import session
original_dir = session.SESSIONS_DIR original_dir = session.SESSIONS_DIR
monkeypatch.setattr(session, "SESSIONS_DIR", str(tmp_path)) monkeypatch.setattr(session, "SESSIONS_DIR", str(tmp_path))

View File

@ -1,12 +1,12 @@
import os import os
import tempfile import tempfile
from rp.tools.base import get_tools_definition from pr.tools.base import get_tools_definition
from rp.tools.command import run_command from pr.tools.command import run_command
from rp.tools.filesystem import chdir, getpwd, list_directory, read_file, search_replace, write_file from pr.tools.filesystem import chdir, getpwd, list_directory, read_file, search_replace, write_file
from rp.tools.interactive_control import start_interactive_session from pr.tools.interactive_control import start_interactive_session
from rp.tools.patch import apply_patch, create_diff from pr.tools.patch import apply_patch, create_diff
from rp.tools.python_exec import python_exec from pr.tools.python_exec import python_exec
class TestFilesystemTools: class TestFilesystemTools:

View File

@ -1,6 +1,6 @@
import json import json
from unittest.mock import patch from unittest.mock import patch
from rp.ui.output import OutputFormatter from pr.ui.output import OutputFormatter
class TestOutputFormatter: class TestOutputFormatter:

View File

@ -3,12 +3,12 @@ import os
import pytest import pytest
from rp.core.usage_tracker import UsageTracker from pr.core.usage_tracker import UsageTracker
@pytest.fixture @pytest.fixture
def temp_usage_file(tmp_path, monkeypatch): def temp_usage_file(tmp_path, monkeypatch):
from rp.core import usage_tracker from pr.core import usage_tracker
original_file = usage_tracker.USAGE_DB_FILE original_file = usage_tracker.USAGE_DB_FILE
temp_file = str(tmp_path / "usage.json") temp_file = str(tmp_path / "usage.json")

View File

@ -3,8 +3,8 @@ import tempfile
import pytest import pytest
from rp.core.exceptions import ValidationError from pr.core.exceptions import ValidationError
from rp.core.validation import ( from pr.core.validation import (
validate_api_url, validate_api_url,
validate_directory_path, validate_directory_path,
validate_file_path, validate_file_path,