feat(mma): Complete Phase 3 context features (injection, dependency mapping, logging)
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import pytest
|
||||
import os
|
||||
from unittest.mock import patch, MagicMock
|
||||
from scripts.mma_exec import create_parser, get_role_documents, execute_agent, get_model_for_role, get_dependencies
|
||||
|
||||
@@ -115,3 +116,29 @@ def test_execute_agent_logging(tmp_path):
|
||||
assert test_role in log_content
|
||||
assert test_prompt in log_content
|
||||
assert re.search(r"\d{4}-\d{2}-\d{2}", log_content)
|
||||
|
||||
|
||||
def test_execute_agent_tier3_injection(tmp_path):
|
||||
main_content = "import dependency\n\ndef run():\n dependency.do_work()\n"
|
||||
main_file = tmp_path / "main.py"
|
||||
main_file.write_text(main_content)
|
||||
dep_content = "def do_work():\n pass\n\ndef other_func():\n print('hello')\n"
|
||||
dep_file = tmp_path / "dependency.py"
|
||||
dep_file.write_text(dep_content)
|
||||
old_cwd = os.getcwd()
|
||||
os.chdir(tmp_path)
|
||||
try:
|
||||
with patch("subprocess.run") as mock_run:
|
||||
mock_process = MagicMock()
|
||||
mock_process.stdout = "OK"
|
||||
mock_process.returncode = 0
|
||||
mock_run.return_value = mock_process
|
||||
execute_agent('tier3-worker', 'Modify main.py', ['main.py'])
|
||||
assert mock_run.called
|
||||
cmd_list = mock_run.call_args[0][0]
|
||||
full_command = " ".join(str(arg) for arg in cmd_list)
|
||||
assert "DEPENDENCY SKELETON: dependency.py" in full_command
|
||||
assert "def do_work():" in full_command
|
||||
assert "Modify main.py" in full_command
|
||||
finally:
|
||||
os.chdir(old_cwd)
|
||||
|
||||
Reference in New Issue
Block a user