conductor(checkpoint): Phase 3: Test Track Implementation complete
This commit is contained in:
57
tests/conductor/test_infrastructure.py
Normal file
57
tests/conductor/test_infrastructure.py
Normal file
@@ -0,0 +1,57 @@
|
||||
import subprocess
|
||||
import pytest
|
||||
import os
|
||||
|
||||
def run_ps_script(role, prompt):
|
||||
"""Helper to run the run_subagent.ps1 script."""
|
||||
# Using -File is safer and handles arguments better
|
||||
cmd = [
|
||||
"powershell", "-NoProfile", "-ExecutionPolicy", "Bypass",
|
||||
"-File", "./scripts/run_subagent.ps1",
|
||||
"-Role", role,
|
||||
"-Prompt", prompt
|
||||
]
|
||||
result = subprocess.run(cmd, capture_output=True, text=True)
|
||||
if result.stdout:
|
||||
print(f"\n[Sub-Agent {role} Output]:\n{result.stdout}")
|
||||
if result.stderr:
|
||||
print(f"\n[Sub-Agent {role} Error]:\n{result.stderr}")
|
||||
return result
|
||||
|
||||
def test_subagent_script_qa_live():
|
||||
"""Verify that the QA role works and returns a compressed fix."""
|
||||
prompt = "Traceback (most recent call last): File 'test.py', line 1, in <module> 1/0 ZeroDivisionError: division by zero"
|
||||
result = run_ps_script("QA", prompt)
|
||||
|
||||
assert result.returncode == 0
|
||||
# Expected output should mention the fix for division by zero
|
||||
assert "zero" in result.stdout.lower()
|
||||
# It should be short (QA agents compress)
|
||||
assert len(result.stdout.split()) < 40
|
||||
|
||||
def test_subagent_script_worker_live():
|
||||
"""Verify that the Worker role works and returns code."""
|
||||
prompt = "Write a python function that returns 'hello world'"
|
||||
result = run_ps_script("Worker", prompt)
|
||||
|
||||
assert result.returncode == 0
|
||||
assert "def" in result.stdout.lower()
|
||||
assert "hello" in result.stdout.lower()
|
||||
|
||||
def test_subagent_script_utility_live():
|
||||
"""Verify that the Utility role works."""
|
||||
prompt = "Tell me 'True' if 1+1=2, otherwise 'False'"
|
||||
result = run_ps_script("Utility", prompt)
|
||||
|
||||
assert result.returncode == 0
|
||||
assert "true" in result.stdout.lower()
|
||||
|
||||
def test_subagent_isolation_live():
|
||||
"""Verify that the sub-agent is stateless and does not see the parent's conversation context."""
|
||||
# This prompt asks the sub-agent about a 'secret' mentioned only here, not in its prompt.
|
||||
prompt = "What is the secret code I just told you? If I didn't tell you, say 'UNKNOWN'."
|
||||
result = run_ps_script("Utility", prompt)
|
||||
|
||||
assert result.returncode == 0
|
||||
# A stateless agent should not know any previous context.
|
||||
assert "unknown" in result.stdout.lower()
|
||||
Reference in New Issue
Block a user