From e344bdfe813d9488aea0a52c5666686011d3610a Mon Sep 17 00:00:00 2001 From: retoor Date: Fri, 7 Nov 2025 18:50:28 +0100 Subject: [PATCH] maintenance: remove old, unused parts of the codebase feat: update version to 1.16.0 refactor: update imports from pr to rp in tests maintenance: update tests to use rp instead of pr --- CHANGELOG.md | 8 ++ pyproject.toml | 2 +- tests/test_assistant.py | 22 ++--- tests/test_commands.py | 126 ++++++++++++++--------------- tests/test_config.py | 2 +- tests/test_config_loader.py | 2 +- tests/test_context.py | 4 +- tests/test_conversation_memory.py | 2 +- tests/test_exceptions.py | 2 +- tests/test_fact_extractor.py | 2 +- tests/test_help_docs.py | 2 +- tests/test_knowledge_store.py | 2 +- tests/test_logging.py | 30 +++---- tests/test_multiplexer_commands.py | 66 +++++++-------- tests/test_semantic_index.py | 2 +- tests/test_session.py | 4 +- tests/test_tools.py | 12 +-- tests/test_ui_output.py | 2 +- tests/test_usage_tracker.py | 4 +- tests/test_validation.py | 4 +- 20 files changed, 154 insertions(+), 146 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 92c9bd2..6483e32 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,14 @@ + +## 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 Several internal modules and features have been removed from the codebase. This simplifies the project and removes functionality that was no longer in use. diff --git a/pyproject.toml b/pyproject.toml index 9620df5..b498cbc 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "rp" -version = "1.14.0" +version = "1.15.0" description = "R python edition. The ultimate autonomous AI CLI." readme = "README.md" requires-python = ">=3.12" diff --git a/tests/test_assistant.py b/tests/test_assistant.py index 22a91da..f65db16 100644 --- a/tests/test_assistant.py +++ b/tests/test_assistant.py @@ -1,7 +1,7 @@ import unittest from unittest.mock import MagicMock, patch -from pr.core.assistant import Assistant, process_message +from rp.core.assistant import Assistant, process_message class TestAssistant(unittest.TestCase): @@ -17,8 +17,8 @@ class TestAssistant(unittest.TestCase): @patch("sqlite3.connect") @patch("os.environ.get") - @patch("pr.core.context.init_system_message") - @patch("pr.core.enhanced_assistant.EnhancedAssistant") + @patch("rp.core.context.init_system_message") + @patch("rp.core.enhanced_assistant.EnhancedAssistant") def test_init(self, mock_enhanced, mock_init_sys, mock_env, mock_sqlite): mock_env.side_effect = lambda key, default: { "OPENROUTER_API_KEY": "key", @@ -38,8 +38,8 @@ class TestAssistant(unittest.TestCase): self.assertEqual(assistant.model, "test-model") mock_sqlite.assert_called_once() - @patch("pr.core.assistant.call_api") - @patch("pr.core.assistant.render_markdown") + @patch("rp.core.assistant.call_api") + @patch("rp.core.assistant.render_markdown") def test_process_response_no_tools(self, mock_render, mock_call): assistant = MagicMock() assistant.verbose = False @@ -53,9 +53,9 @@ class TestAssistant(unittest.TestCase): self.assertEqual(result, "rendered") assistant.messages.append.assert_called_with({"content": "content"}) - @patch("pr.core.assistant.call_api") - @patch("pr.core.assistant.render_markdown") - @patch("pr.core.assistant.get_tools_definition") + @patch("rp.core.assistant.call_api") + @patch("rp.core.assistant.render_markdown") + @patch("rp.core.assistant.get_tools_definition") def test_process_response_with_tools(self, mock_tools_def, mock_render, mock_call): assistant = MagicMock() assistant.verbose = False @@ -86,8 +86,8 @@ class TestAssistant(unittest.TestCase): mock_call.assert_called() - @patch("pr.core.assistant.call_api") - @patch("pr.core.assistant.get_tools_definition") + @patch("rp.core.assistant.call_api") + @patch("rp.core.assistant.get_tools_definition") def test_process_message(self, mock_tools, mock_call): assistant = MagicMock() assistant.verbose = False @@ -98,7 +98,7 @@ class TestAssistant(unittest.TestCase): mock_tools.return_value = [] mock_call.return_value = {"choices": [{"message": {"content": "response"}}]} - with patch("pr.core.assistant.render_markdown", return_value="rendered"): + with patch("rp.core.assistant.render_markdown", return_value="rendered"): with patch("builtins.print"): process_message(assistant, "test message") diff --git a/tests/test_commands.py b/tests/test_commands.py index 036d975..cc89377 100644 --- a/tests/test_commands.py +++ b/tests/test_commands.py @@ -1,5 +1,5 @@ from unittest.mock import Mock, patch -from pr.commands.handlers import ( +from rp.commands.handlers import ( handle_command, review_file, refactor_file, @@ -35,9 +35,9 @@ class TestHandleCommand: self.assistant.model_list_url = "http://test.com" self.assistant.api_key = "test-key" - @patch("pr.commands.handlers.run_autonomous_mode") + @patch("rp.commands.handlers.run_autonomous_mode") def test_handle_edit(self, mock_run): - with patch("pr.commands.handlers.RPEditor") as mock_editor: + with patch("rp.commands.handlers.RPEditor") as mock_editor: mock_editor_instance = Mock() mock_editor.return_value = mock_editor_instance 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_editor_instance.stop.assert_called_once() - @patch("pr.commands.handlers.run_autonomous_mode") + @patch("rp.commands.handlers.run_autonomous_mode") def test_handle_auto(self, mock_run): result = handle_command(self.assistant, "/auto test task") assert result is True @@ -62,14 +62,14 @@ class TestHandleCommand: result = handle_command(self.assistant, "exit") assert result is False - @patch("pr.commands.help_docs.get_full_help") + @patch("rp.commands.help_docs.get_full_help") def test_handle_help(self, mock_help): mock_help.return_value = "full help" result = handle_command(self.assistant, "/help") assert result is True mock_help.assert_called_once() - @patch("pr.commands.help_docs.get_workflow_help") + @patch("rp.commands.help_docs.get_workflow_help") def test_handle_help_workflows(self, mock_help): mock_help.return_value = "workflow help" result = handle_command(self.assistant, "/help workflows") @@ -103,57 +103,57 @@ class TestHandleCommand: assert result is True assert self.assistant.model == "new-model" - @patch("pr.commands.handlers.list_models") + @patch("rp.commands.handlers.list_models") def test_handle_models(self, mock_list): mock_list.return_value = [{"id": "model1"}, {"id": "model2"}] result = handle_command(self.assistant, "/models") assert result is True mock_list.assert_called_once_with("http://test.com", "test-key") - @patch("pr.commands.handlers.list_models") + @patch("rp.commands.handlers.list_models") def test_handle_models_error(self, mock_list): mock_list.return_value = {"error": "test error"} result = handle_command(self.assistant, "/models") assert result is True - @patch("pr.commands.handlers.get_tools_definition") + @patch("rp.commands.handlers.get_tools_definition") def test_handle_tools(self, mock_tools): mock_tools.return_value = [{"function": {"name": "tool1", "description": "desc"}}] result = handle_command(self.assistant, "/tools") assert result is True mock_tools.assert_called_once() - @patch("pr.commands.handlers.review_file") + @patch("rp.commands.handlers.review_file") def test_handle_review(self, mock_review): result = handle_command(self.assistant, "/review test.py") assert result is True mock_review.assert_called_once_with(self.assistant, "test.py") - @patch("pr.commands.handlers.refactor_file") + @patch("rp.commands.handlers.refactor_file") def test_handle_refactor(self, mock_refactor): result = handle_command(self.assistant, "/refactor test.py") assert result is True mock_refactor.assert_called_once_with(self.assistant, "test.py") - @patch("pr.commands.handlers.obfuscate_file") + @patch("rp.commands.handlers.obfuscate_file") def test_handle_obfuscate(self, mock_obfuscate): result = handle_command(self.assistant, "/obfuscate test.py") assert result is True mock_obfuscate.assert_called_once_with(self.assistant, "test.py") - @patch("pr.commands.handlers.show_workflows") + @patch("rp.commands.handlers.show_workflows") def test_handle_workflows(self, mock_show): result = handle_command(self.assistant, "/workflows") assert result is True mock_show.assert_called_once_with(self.assistant) - @patch("pr.commands.handlers.execute_workflow_command") + @patch("rp.commands.handlers.execute_workflow_command") def test_handle_workflow(self, mock_exec): result = handle_command(self.assistant, "/workflow test") assert result is True mock_exec.assert_called_once_with(self.assistant, "test") - @patch("pr.commands.handlers.execute_agent_task") + @patch("rp.commands.handlers.execute_agent_task") def test_handle_agent(self, mock_exec): result = handle_command(self.assistant, "/agent coding test task") assert result is True @@ -163,55 +163,55 @@ class TestHandleCommand: result = handle_command(self.assistant, "/agent") assert result is True - @patch("pr.commands.handlers.show_agents") + @patch("rp.commands.handlers.show_agents") def test_handle_agents(self, mock_show): result = handle_command(self.assistant, "/agents") assert result is True mock_show.assert_called_once_with(self.assistant) - @patch("pr.commands.handlers.collaborate_agents_command") + @patch("rp.commands.handlers.collaborate_agents_command") def test_handle_collaborate(self, mock_collab): result = handle_command(self.assistant, "/collaborate test task") assert result is True mock_collab.assert_called_once_with(self.assistant, "test task") - @patch("pr.commands.handlers.search_knowledge") + @patch("rp.commands.handlers.search_knowledge") def test_handle_knowledge(self, mock_search): result = handle_command(self.assistant, "/knowledge test query") assert result is True mock_search.assert_called_once_with(self.assistant, "test query") - @patch("pr.commands.handlers.store_knowledge") + @patch("rp.commands.handlers.store_knowledge") def test_handle_remember(self, mock_store): result = handle_command(self.assistant, "/remember test content") assert result is True mock_store.assert_called_once_with(self.assistant, "test content") - @patch("pr.commands.handlers.show_conversation_history") + @patch("rp.commands.handlers.show_conversation_history") def test_handle_history(self, mock_show): result = handle_command(self.assistant, "/history") assert result is True mock_show.assert_called_once_with(self.assistant) - @patch("pr.commands.handlers.show_cache_stats") + @patch("rp.commands.handlers.show_cache_stats") def test_handle_cache(self, mock_show): result = handle_command(self.assistant, "/cache") assert result is True mock_show.assert_called_once_with(self.assistant) - @patch("pr.commands.handlers.clear_caches") + @patch("rp.commands.handlers.clear_caches") def test_handle_cache_clear(self, mock_clear): result = handle_command(self.assistant, "/cache clear") assert result is True mock_clear.assert_called_once_with(self.assistant) - @patch("pr.commands.handlers.show_system_stats") + @patch("rp.commands.handlers.show_system_stats") def test_handle_stats(self, mock_show): result = handle_command(self.assistant, "/stats") assert result is True mock_show.assert_called_once_with(self.assistant) - @patch("pr.commands.handlers.handle_background_command") + @patch("rp.commands.handlers.handle_background_command") def test_handle_bg(self, mock_bg): result = handle_command(self.assistant, "/bg list") assert result is True @@ -226,8 +226,8 @@ class TestReviewFile: def setup_method(self): self.assistant = Mock() - @patch("pr.commands.handlers.read_file") - @patch("pr.core.assistant.process_message") + @patch("rp.commands.handlers.read_file") + @patch("rp.core.assistant.process_message") @patch("asyncio.create_task") async def test_review_file_success(self, mock_create_task, mock_process, mock_read): mock_read.return_value = {"status": "success", "content": "test content"} @@ -237,7 +237,7 @@ class TestReviewFile: args = mock_process.call_args[0] assert "Please review this file" in args[1] - @patch("pr.commands.handlers.read_file") + @patch("rp.commands.handlers.read_file") def test_review_file_error(self, mock_read): mock_read.return_value = {"status": "error", "error": "file not found"} review_file(self.assistant, "test.py") @@ -248,8 +248,8 @@ class TestRefactorFile: def setup_method(self): self.assistant = Mock() - @patch("pr.commands.handlers.read_file") - @patch("pr.core.assistant.process_message") + @patch("rp.commands.handlers.read_file") + @patch("rp.core.assistant.process_message") def test_refactor_file_success(self, mock_process, mock_read): mock_read.return_value = {"status": "success", "content": "test content"} refactor_file(self.assistant, "test.py") @@ -257,7 +257,7 @@ class TestRefactorFile: args = mock_process.call_args[0] assert "Please refactor this code" in args[1] - @patch("pr.commands.handlers.read_file") + @patch("rp.commands.handlers.read_file") def test_refactor_file_error(self, mock_read): mock_read.return_value = {"status": "error", "error": "file not found"} refactor_file(self.assistant, "test.py") @@ -267,8 +267,8 @@ class TestObfuscateFile: def setup_method(self): self.assistant = Mock() - @patch("pr.commands.handlers.read_file") - @patch("pr.core.assistant.process_message") + @patch("rp.commands.handlers.read_file") + @patch("rp.core.assistant.process_message") def test_obfuscate_file_success(self, mock_process, mock_read): mock_read.return_value = {"status": "success", "content": "test content"} obfuscate_file(self.assistant, "test.py") @@ -276,7 +276,7 @@ class TestObfuscateFile: args = mock_process.call_args[0] assert "Please obfuscate this code" in args[1] - @patch("pr.commands.handlers.read_file") + @patch("rp.commands.handlers.read_file") def test_obfuscate_file_error(self, mock_read): mock_read.return_value = {"status": "error", "error": "file not found"} obfuscate_file(self.assistant, "test.py") @@ -411,7 +411,7 @@ class TestStoreKnowledge: delattr(self.assistant, "enhanced") store_knowledge(self.assistant, "content") - @patch("pr.memory.KnowledgeEntry") + @patch("rp.memory.KnowledgeEntry") def test_store_knowledge_success(self, mock_entry): self.assistant.enhanced = Mock() self.assistant.enhanced.fact_extractor.categorize_content.return_value = ["general"] @@ -520,31 +520,31 @@ class TestHandleBackgroundCommand: def test_handle_bg_no_args(self): handle_background_command(self.assistant, "/bg") - @patch("pr.commands.handlers.start_background_session") + @patch("rp.commands.handlers.start_background_session") def test_handle_bg_start(self, mock_start): handle_background_command(self.assistant, "/bg start ls -la") - @patch("pr.commands.handlers.list_background_sessions") + @patch("rp.commands.handlers.list_background_sessions") def test_handle_bg_list(self, mock_list): handle_background_command(self.assistant, "/bg list") - @patch("pr.commands.handlers.show_session_status") + @patch("rp.commands.handlers.show_session_status") def test_handle_bg_status(self, mock_status): handle_background_command(self.assistant, "/bg status session1") - @patch("pr.commands.handlers.show_session_output") + @patch("rp.commands.handlers.show_session_output") def test_handle_bg_output(self, mock_output): handle_background_command(self.assistant, "/bg output session1") - @patch("pr.commands.handlers.send_session_input") + @patch("rp.commands.handlers.send_session_input") def test_handle_bg_input(self, mock_input): handle_background_command(self.assistant, "/bg input session1 test input") - @patch("pr.commands.handlers.kill_background_session") + @patch("rp.commands.handlers.kill_background_session") def test_handle_bg_kill(self, mock_kill): handle_background_command(self.assistant, "/bg kill session1") - @patch("pr.commands.handlers.show_background_events") + @patch("rp.commands.handlers.show_background_events") def test_handle_bg_events(self, mock_events): handle_background_command(self.assistant, "/bg events") @@ -556,17 +556,17 @@ class TestStartBackgroundSession: def setup_method(self): self.assistant = Mock() - @patch("pr.multiplexer.start_background_process") + @patch("rp.multiplexer.start_background_process") def test_start_background_success(self, mock_start): mock_start.return_value = {"status": "success", "pid": 123} start_background_session(self.assistant, "session1", "ls -la") - @patch("pr.multiplexer.start_background_process") + @patch("rp.multiplexer.start_background_process") def test_start_background_error(self, mock_start): mock_start.return_value = {"status": "error", "error": "failed"} start_background_session(self.assistant, "session1", "ls -la") - @patch("pr.multiplexer.start_background_process") + @patch("rp.multiplexer.start_background_process") def test_start_background_exception(self, mock_start): mock_start.side_effect = Exception("test") start_background_session(self.assistant, "session1", "ls -la") @@ -576,13 +576,13 @@ class TestListBackgroundSessions: def setup_method(self): self.assistant = Mock() - @patch("pr.multiplexer.get_all_sessions") - @patch("pr.ui.display.display_multiplexer_status") + @patch("rp.multiplexer.get_all_sessions") + @patch("rp.ui.display.display_multiplexer_status") def test_list_sessions_success(self, mock_display, mock_get): mock_get.return_value = {} list_background_sessions(self.assistant) - @patch("pr.multiplexer.get_all_sessions") + @patch("rp.multiplexer.get_all_sessions") def test_list_sessions_exception(self, mock_get): mock_get.side_effect = Exception("test") list_background_sessions(self.assistant) @@ -592,7 +592,7 @@ class TestShowSessionStatus: def setup_method(self): self.assistant = Mock() - @patch("pr.multiplexer.get_session_info") + @patch("rp.multiplexer.get_session_info") def test_show_status_found(self, mock_get): mock_get.return_value = { "status": "running", @@ -602,12 +602,12 @@ class TestShowSessionStatus: } show_session_status(self.assistant, "session1") - @patch("pr.multiplexer.get_session_info") + @patch("rp.multiplexer.get_session_info") def test_show_status_not_found(self, mock_get): mock_get.return_value = None show_session_status(self.assistant, "session1") - @patch("pr.multiplexer.get_session_info") + @patch("rp.multiplexer.get_session_info") def test_show_status_exception(self, mock_get): mock_get.side_effect = Exception("test") show_session_status(self.assistant, "session1") @@ -617,17 +617,17 @@ class TestShowSessionOutput: def setup_method(self): self.assistant = Mock() - @patch("pr.multiplexer.get_session_output") + @patch("rp.multiplexer.get_session_output") def test_show_output_success(self, mock_get): mock_get.return_value = ["line1", "line2"] show_session_output(self.assistant, "session1") - @patch("pr.multiplexer.get_session_output") + @patch("rp.multiplexer.get_session_output") def test_show_output_no_output(self, mock_get): mock_get.return_value = None show_session_output(self.assistant, "session1") - @patch("pr.multiplexer.get_session_output") + @patch("rp.multiplexer.get_session_output") def test_show_output_exception(self, mock_get): mock_get.side_effect = Exception("test") show_session_output(self.assistant, "session1") @@ -637,17 +637,17 @@ class TestSendSessionInput: def setup_method(self): self.assistant = Mock() - @patch("pr.multiplexer.send_input_to_session") + @patch("rp.multiplexer.send_input_to_session") def test_send_input_success(self, mock_send): mock_send.return_value = {"status": "success"} send_session_input(self.assistant, "session1", "input") - @patch("pr.multiplexer.send_input_to_session") + @patch("rp.multiplexer.send_input_to_session") def test_send_input_error(self, mock_send): mock_send.return_value = {"status": "error", "error": "failed"} send_session_input(self.assistant, "session1", "input") - @patch("pr.multiplexer.send_input_to_session") + @patch("rp.multiplexer.send_input_to_session") def test_send_input_exception(self, mock_send): mock_send.side_effect = Exception("test") send_session_input(self.assistant, "session1", "input") @@ -657,17 +657,17 @@ class TestKillBackgroundSession: def setup_method(self): self.assistant = Mock() - @patch("pr.multiplexer.kill_session") + @patch("rp.multiplexer.kill_session") def test_kill_success(self, mock_kill): mock_kill.return_value = {"status": "success"} kill_background_session(self.assistant, "session1") - @patch("pr.multiplexer.kill_session") + @patch("rp.multiplexer.kill_session") def test_kill_error(self, mock_kill): mock_kill.return_value = {"status": "error", "error": "failed"} kill_background_session(self.assistant, "session1") - @patch("pr.multiplexer.kill_session") + @patch("rp.multiplexer.kill_session") def test_kill_exception(self, mock_kill): mock_kill.side_effect = Exception("test") kill_background_session(self.assistant, "session1") @@ -677,22 +677,22 @@ class TestShowBackgroundEvents: def setup_method(self): self.assistant = Mock() - @patch("pr.core.background_monitor.get_global_monitor") + @patch("rp.core.background_monitor.get_global_monitor") def test_show_events_success(self, mock_get): mock_monitor = Mock() mock_monitor.get_events.return_value = [{"event": "test"}] mock_get.return_value = mock_monitor - with patch("pr.ui.display.display_background_event"): + with patch("rp.ui.display.display_background_event"): show_background_events(self.assistant) - @patch("pr.core.background_monitor.get_global_monitor") + @patch("rp.core.background_monitor.get_global_monitor") def test_show_events_no_events(self, mock_get): mock_monitor = Mock() mock_monitor.get_events.return_value = [] mock_get.return_value = mock_monitor show_background_events(self.assistant) - @patch("pr.core.background_monitor.get_global_monitor") + @patch("rp.core.background_monitor.get_global_monitor") def test_show_events_exception(self, mock_get): mock_get.side_effect = Exception("test") show_background_events(self.assistant) diff --git a/tests/test_config.py b/tests/test_config.py index 1cadc20..2333cba 100644 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -1,4 +1,4 @@ -from pr import config +from rp import config class TestConfig: diff --git a/tests/test_config_loader.py b/tests/test_config_loader.py index 433fce0..35fbe5f 100644 --- a/tests/test_config_loader.py +++ b/tests/test_config_loader.py @@ -1,6 +1,6 @@ from unittest.mock import patch -from pr.core.config_loader import ( +from rp.core.config_loader import ( _load_config_file, _parse_value, ) diff --git a/tests/test_context.py b/tests/test_context.py index f7ec596..3aacb93 100644 --- a/tests/test_context.py +++ b/tests/test_context.py @@ -1,5 +1,5 @@ -from pr.config import RECENT_MESSAGES_TO_KEEP -from pr.core.context import compress_context, should_compress_context +from rp.config import RECENT_MESSAGES_TO_KEEP +from rp.core.context import compress_context, should_compress_context class TestContextManagement: diff --git a/tests/test_conversation_memory.py b/tests/test_conversation_memory.py index b4378f5..bcb1d52 100644 --- a/tests/test_conversation_memory.py +++ b/tests/test_conversation_memory.py @@ -3,7 +3,7 @@ import tempfile import os import time -from pr.memory.conversation_memory import ConversationMemory +from rp.memory.conversation_memory import ConversationMemory class TestConversationMemory: diff --git a/tests/test_exceptions.py b/tests/test_exceptions.py index 024e120..b697565 100644 --- a/tests/test_exceptions.py +++ b/tests/test_exceptions.py @@ -1,5 +1,5 @@ import pytest -from pr.core.exceptions import ( +from rp.core.exceptions import ( PRException, APIException, APIConnectionError, diff --git a/tests/test_fact_extractor.py b/tests/test_fact_extractor.py index a0955c2..7481aa3 100644 --- a/tests/test_fact_extractor.py +++ b/tests/test_fact_extractor.py @@ -1,4 +1,4 @@ -from pr.memory.fact_extractor import FactExtractor +from rp.memory.fact_extractor import FactExtractor class TestFactExtractor: diff --git a/tests/test_help_docs.py b/tests/test_help_docs.py index f0e9e67..38453a4 100644 --- a/tests/test_help_docs.py +++ b/tests/test_help_docs.py @@ -1,4 +1,4 @@ -from pr.commands.help_docs import ( +from rp.commands.help_docs import ( get_workflow_help, get_agent_help, get_knowledge_help, diff --git a/tests/test_knowledge_store.py b/tests/test_knowledge_store.py index baab6d8..a45327f 100644 --- a/tests/test_knowledge_store.py +++ b/tests/test_knowledge_store.py @@ -3,7 +3,7 @@ import tempfile import os import time -from pr.memory.knowledge_store import KnowledgeStore, KnowledgeEntry +from rp.memory.knowledge_store import KnowledgeStore, KnowledgeEntry class TestKnowledgeStore: diff --git a/tests/test_logging.py b/tests/test_logging.py index b83ef02..5cdcf46 100644 --- a/tests/test_logging.py +++ b/tests/test_logging.py @@ -1,13 +1,13 @@ from unittest.mock import patch, MagicMock -from pr.core.logging import setup_logging, get_logger +from rp.core.logging import setup_logging, get_logger class TestLogging: - @patch("pr.core.logging.os.makedirs") - @patch("pr.core.logging.os.path.dirname") - @patch("pr.core.logging.os.path.exists") - @patch("pr.core.logging.RotatingFileHandler") - @patch("pr.core.logging.logging.getLogger") + @patch("rp.core.logging.os.makedirs") + @patch("rp.core.logging.os.path.dirname") + @patch("rp.core.logging.os.path.exists") + @patch("rp.core.logging.RotatingFileHandler") + @patch("rp.core.logging.logging.getLogger") def test_setup_logging_basic( self, mock_get_logger, mock_handler, mock_exists, mock_dirname, mock_makedirs ): @@ -25,12 +25,12 @@ class TestLogging: mock_handler.assert_called_once() assert result == mock_logger - @patch("pr.core.logging.os.makedirs") - @patch("pr.core.logging.os.path.dirname") - @patch("pr.core.logging.os.path.exists") - @patch("pr.core.logging.RotatingFileHandler") - @patch("pr.core.logging.logging.StreamHandler") - @patch("pr.core.logging.logging.getLogger") + @patch("rp.core.logging.os.makedirs") + @patch("rp.core.logging.os.path.dirname") + @patch("rp.core.logging.os.path.exists") + @patch("rp.core.logging.RotatingFileHandler") + @patch("rp.core.logging.logging.StreamHandler") + @patch("rp.core.logging.logging.getLogger") def test_setup_logging_verbose( self, mock_get_logger, @@ -56,7 +56,7 @@ class TestLogging: mock_stream_handler.assert_called_once() assert result == mock_logger - @patch("pr.core.logging.logging.getLogger") + @patch("rp.core.logging.logging.getLogger") def test_get_logger_default(self, mock_get_logger): mock_logger = MagicMock() mock_get_logger.return_value = mock_logger @@ -66,12 +66,12 @@ class TestLogging: mock_get_logger.assert_called_once_with("pr") assert result == mock_logger - @patch("pr.core.logging.logging.getLogger") + @patch("rp.core.logging.logging.getLogger") def test_get_logger_named(self, mock_get_logger): mock_logger = MagicMock() mock_get_logger.return_value = mock_logger result = get_logger("test") - mock_get_logger.assert_called_once_with("pr.test") + mock_get_logger.assert_called_once_with("rp.test") assert result == mock_logger diff --git a/tests/test_multiplexer_commands.py b/tests/test_multiplexer_commands.py index 9861e6a..568f6eb 100644 --- a/tests/test_multiplexer_commands.py +++ b/tests/test_multiplexer_commands.py @@ -1,5 +1,5 @@ from unittest.mock import Mock, patch -from pr.commands.multiplexer_commands import ( +from rp.commands.multiplexer_commands import ( show_sessions, attach_session, detach_session, @@ -12,15 +12,15 @@ from pr.commands.multiplexer_commands import ( class TestShowSessions: - @patch("pr.commands.multiplexer_commands.list_active_sessions") - @patch("pr.commands.multiplexer_commands.get_session_status") + @patch("rp.commands.multiplexer_commands.list_active_sessions") + @patch("rp.commands.multiplexer_commands.get_session_status") def test_show_sessions_no_sessions(self, mock_status, mock_list): mock_list.return_value = {} show_sessions() mock_list.assert_called_once() - @patch("pr.commands.multiplexer_commands.list_active_sessions") - @patch("pr.commands.multiplexer_commands.get_session_status") + @patch("rp.commands.multiplexer_commands.list_active_sessions") + @patch("rp.commands.multiplexer_commands.get_session_status") def test_show_sessions_with_sessions(self, mock_status, mock_list): mock_list.return_value = { "session1": { @@ -43,27 +43,27 @@ class TestAttachSession: def test_attach_session_no_args(self): attach_session([]) - @patch("pr.commands.multiplexer_commands.get_session_status") + @patch("rp.commands.multiplexer_commands.get_session_status") def test_attach_session_not_found(self, mock_status): mock_status.return_value = None attach_session(["session1"]) - @patch("pr.commands.multiplexer_commands.get_session_status") - @patch("pr.commands.multiplexer_commands.read_session_output") + @patch("rp.commands.multiplexer_commands.get_session_status") + @patch("rp.commands.multiplexer_commands.read_session_output") def test_attach_session_success(self, mock_read, mock_status): mock_status.return_value = {"is_active": True, "metadata": {"process_type": "test"}} mock_read.return_value = {"stdout": "line1\nline2", "stderr": ""} attach_session(["session1"]) - @patch("pr.commands.multiplexer_commands.get_session_status") - @patch("pr.commands.multiplexer_commands.read_session_output") + @patch("rp.commands.multiplexer_commands.get_session_status") + @patch("rp.commands.multiplexer_commands.read_session_output") def test_attach_session_with_stderr(self, mock_read, mock_status): mock_status.return_value = {"is_active": False, "metadata": {"process_type": "test"}} mock_read.return_value = {"stdout": "", "stderr": "error1\nerror2"} attach_session(["session1"]) - @patch("pr.commands.multiplexer_commands.get_session_status") - @patch("pr.commands.multiplexer_commands.read_session_output") + @patch("rp.commands.multiplexer_commands.get_session_status") + @patch("rp.commands.multiplexer_commands.read_session_output") def test_attach_session_read_error(self, mock_read, mock_status): mock_status.return_value = {"is_active": True, "metadata": {"process_type": "test"}} mock_read.side_effect = Exception("test error") @@ -74,12 +74,12 @@ class TestDetachSession: def test_detach_session_no_args(self): detach_session([]) - @patch("pr.commands.multiplexer_commands.get_multiplexer") + @patch("rp.commands.multiplexer_commands.get_multiplexer") def test_detach_session_not_found(self, mock_get): mock_get.return_value = None detach_session(["session1"]) - @patch("pr.commands.multiplexer_commands.get_multiplexer") + @patch("rp.commands.multiplexer_commands.get_multiplexer") def test_detach_session_success(self, mock_get): mock_mux = Mock() mock_get.return_value = mock_mux @@ -91,12 +91,12 @@ class TestKillSession: def test_kill_session_no_args(self): kill_session([]) - @patch("pr.commands.multiplexer_commands.close_interactive_session") + @patch("rp.commands.multiplexer_commands.close_interactive_session") def test_kill_session_success(self, mock_close): kill_session(["session1"]) mock_close.assert_called_once_with("session1") - @patch("pr.commands.multiplexer_commands.close_interactive_session") + @patch("rp.commands.multiplexer_commands.close_interactive_session") def test_kill_session_error(self, mock_close): mock_close.side_effect = Exception("test error") kill_session(["session1"]) @@ -109,12 +109,12 @@ class TestSendCommand: def test_send_command_insufficient_args(self): send_command(["session1"]) - @patch("pr.commands.multiplexer_commands.send_input_to_session") + @patch("rp.commands.multiplexer_commands.send_input_to_session") def test_send_command_success(self, mock_send): send_command(["session1", "ls", "-la"]) mock_send.assert_called_once_with("session1", "ls -la") - @patch("pr.commands.multiplexer_commands.send_input_to_session") + @patch("rp.commands.multiplexer_commands.send_input_to_session") def test_send_command_error(self, mock_send): mock_send.side_effect = Exception("test error") send_command(["session1", "ls"]) @@ -124,17 +124,17 @@ class TestShowSessionLog: def test_show_session_log_no_args(self): show_session_log([]) - @patch("pr.commands.multiplexer_commands.read_session_output") + @patch("rp.commands.multiplexer_commands.read_session_output") def test_show_session_log_success(self, mock_read): mock_read.return_value = {"stdout": "stdout content", "stderr": "stderr content"} show_session_log(["session1"]) - @patch("pr.commands.multiplexer_commands.read_session_output") + @patch("rp.commands.multiplexer_commands.read_session_output") def test_show_session_log_no_stderr(self, mock_read): mock_read.return_value = {"stdout": "stdout content", "stderr": ""} show_session_log(["session1"]) - @patch("pr.commands.multiplexer_commands.read_session_output") + @patch("rp.commands.multiplexer_commands.read_session_output") def test_show_session_log_error(self, mock_read): mock_read.side_effect = Exception("test error") show_session_log(["session1"]) @@ -144,13 +144,13 @@ class TestShowSessionStatus: def test_show_session_status_no_args(self): show_session_status([]) - @patch("pr.commands.multiplexer_commands.get_session_status") + @patch("rp.commands.multiplexer_commands.get_session_status") def test_show_session_status_not_found(self, mock_status): mock_status.return_value = None show_session_status(["session1"]) - @patch("pr.commands.multiplexer_commands.get_session_status") - @patch("pr.commands.multiplexer_commands.get_global_detector") + @patch("rp.commands.multiplexer_commands.get_session_status") + @patch("rp.commands.multiplexer_commands.get_global_detector") def test_show_session_status_success(self, mock_detector, mock_status): mock_status.return_value = { "is_active": True, @@ -172,8 +172,8 @@ class TestShowSessionStatus: mock_detector.return_value = mock_detector_instance show_session_status(["session1"]) - @patch("pr.commands.multiplexer_commands.get_session_status") - @patch("pr.commands.multiplexer_commands.get_global_detector") + @patch("rp.commands.multiplexer_commands.get_session_status") + @patch("rp.commands.multiplexer_commands.get_global_detector") def test_show_session_status_no_detector_info(self, mock_detector, mock_status): mock_status.return_value = { "is_active": False, @@ -193,8 +193,8 @@ class TestShowSessionStatus: class TestListWaitingSessions: - @patch("pr.commands.multiplexer_commands.list_active_sessions") - @patch("pr.commands.multiplexer_commands.get_global_detector") + @patch("rp.commands.multiplexer_commands.list_active_sessions") + @patch("rp.commands.multiplexer_commands.get_global_detector") def test_list_waiting_sessions_no_sessions(self, mock_detector, mock_list): mock_list.return_value = {} mock_detector_instance = Mock() @@ -202,9 +202,9 @@ class TestListWaitingSessions: mock_detector.return_value = mock_detector_instance list_waiting_sessions() - @patch("pr.commands.multiplexer_commands.list_active_sessions") - @patch("pr.commands.multiplexer_commands.get_session_status") - @patch("pr.commands.multiplexer_commands.get_global_detector") + @patch("rp.commands.multiplexer_commands.list_active_sessions") + @patch("rp.commands.multiplexer_commands.get_session_status") + @patch("rp.commands.multiplexer_commands.get_global_detector") def test_list_waiting_sessions_with_waiting(self, mock_detector, mock_status, mock_list): mock_list.return_value = ["session1"] mock_detector_instance = Mock() @@ -218,8 +218,8 @@ class TestListWaitingSessions: mock_status.return_value = {"metadata": {"process_type": "test"}} list_waiting_sessions() - @patch("pr.commands.multiplexer_commands.list_active_sessions") - @patch("pr.commands.multiplexer_commands.get_global_detector") + @patch("rp.commands.multiplexer_commands.list_active_sessions") + @patch("rp.commands.multiplexer_commands.get_global_detector") def test_list_waiting_sessions_no_waiting(self, mock_detector, mock_list): mock_list.return_value = ["session1"] mock_detector_instance = Mock() diff --git a/tests/test_semantic_index.py b/tests/test_semantic_index.py index d50b893..001c383 100644 --- a/tests/test_semantic_index.py +++ b/tests/test_semantic_index.py @@ -1,6 +1,6 @@ import math import pytest -from pr.memory.semantic_index import SemanticIndex +from rp.memory.semantic_index import SemanticIndex class TestSemanticIndex: diff --git a/tests/test_session.py b/tests/test_session.py index a7b3838..91a2d7b 100644 --- a/tests/test_session.py +++ b/tests/test_session.py @@ -3,12 +3,12 @@ import os import pytest -from pr.core.session import SessionManager +from rp.core.session import SessionManager @pytest.fixture def temp_sessions_dir(tmp_path, monkeypatch): - from pr.core import session + from rp.core import session original_dir = session.SESSIONS_DIR monkeypatch.setattr(session, "SESSIONS_DIR", str(tmp_path)) diff --git a/tests/test_tools.py b/tests/test_tools.py index 1c16f41..a59a26e 100644 --- a/tests/test_tools.py +++ b/tests/test_tools.py @@ -1,12 +1,12 @@ import os import tempfile -from pr.tools.base import get_tools_definition -from pr.tools.command import run_command -from pr.tools.filesystem import chdir, getpwd, list_directory, read_file, search_replace, write_file -from pr.tools.interactive_control import start_interactive_session -from pr.tools.patch import apply_patch, create_diff -from pr.tools.python_exec import python_exec +from rp.tools.base import get_tools_definition +from rp.tools.command import run_command +from rp.tools.filesystem import chdir, getpwd, list_directory, read_file, search_replace, write_file +from rp.tools.interactive_control import start_interactive_session +from rp.tools.patch import apply_patch, create_diff +from rp.tools.python_exec import python_exec class TestFilesystemTools: diff --git a/tests/test_ui_output.py b/tests/test_ui_output.py index 79ae9a2..d877155 100644 --- a/tests/test_ui_output.py +++ b/tests/test_ui_output.py @@ -1,6 +1,6 @@ import json from unittest.mock import patch -from pr.ui.output import OutputFormatter +from rp.ui.output import OutputFormatter class TestOutputFormatter: diff --git a/tests/test_usage_tracker.py b/tests/test_usage_tracker.py index 3b7116c..5135cec 100644 --- a/tests/test_usage_tracker.py +++ b/tests/test_usage_tracker.py @@ -3,12 +3,12 @@ import os import pytest -from pr.core.usage_tracker import UsageTracker +from rp.core.usage_tracker import UsageTracker @pytest.fixture def temp_usage_file(tmp_path, monkeypatch): - from pr.core import usage_tracker + from rp.core import usage_tracker original_file = usage_tracker.USAGE_DB_FILE temp_file = str(tmp_path / "usage.json") diff --git a/tests/test_validation.py b/tests/test_validation.py index d5d12b1..ed1fce0 100644 --- a/tests/test_validation.py +++ b/tests/test_validation.py @@ -3,8 +3,8 @@ import tempfile import pytest -from pr.core.exceptions import ValidationError -from pr.core.validation import ( +from rp.core.exceptions import ValidationError +from rp.core.validation import ( validate_api_url, validate_directory_path, validate_file_path,