MCPcopy
hub / github.com/aiming-lab/MetaClaw / run_test

Function run_test

scripts/run_e2e_skills_memory_test.py:90–332  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

88
89
90async def run_test():
91 from metaclaw.config_store import ConfigStore
92 from metaclaw.launcher import MetaClawLauncher
93
94 logger.info("=" * 60)
95 logger.info(" MetaClaw E2E Test: skills_only + memory")
96 logger.info("=" * 60)
97
98 # ------------------------------------------------------------------ #
99 # Step 0: Start the proxy #
100 # ------------------------------------------------------------------ #
101 cs = ConfigStore()
102 launcher = MetaClawLauncher(cs)
103 launcher_task = asyncio.create_task(launcher.start())
104
105 await wait_for_proxy()
106 await asyncio.sleep(2) # extra settle time
107
108 results = {"tests": [], "passed": 0, "failed": 0}
109
110 def record(name, passed, detail=""):
111 results["tests"].append({"name": name, "passed": passed, "detail": detail})
112 if passed:
113 results["passed"] += 1
114 logger.info(" PASS: %s %s", name, f"— {detail}" if detail else "")
115 else:
116 results["failed"] += 1
117 logger.error(" FAIL: %s %s", name, f"— {detail}" if detail else "")
118
119 try:
120 # ------------------------------------------------------------------ #
121 # Test 1: Basic proxy forwarding #
122 # ------------------------------------------------------------------ #
123 logger.info("\n--- Test 1: Basic proxy forwarding ---")
124 try:
125 data = await send_chat([
126 {"role": "user", "content": "What is 2+2? Reply with just the number."}
127 ])
128 reply = data["choices"][0]["message"]["content"]
129 record("Basic proxy forwarding", bool(reply), f"reply={reply[:100]}")
130 except Exception as e:
131 record("Basic proxy forwarding", False, str(e))
132
133 # ------------------------------------------------------------------ #
134 # Test 2: Multi-turn conversation (Session 1) #
135 # ------------------------------------------------------------------ #
136 logger.info("\n--- Test 2: Multi-turn session 1 (build context) ---")
137 session1_messages = [
138 {"role": "system", "content": "You are a helpful assistant."},
139 {"role": "user", "content": "My name is Alice and I'm a software engineer at TechCorp. I mainly work with Python and FastAPI."},
140 ]
141 try:
142 data = await send_chat(session1_messages, session_id="session_mem_001")
143 reply1 = data["choices"][0]["message"]["content"]
144 record("Session 1 turn 1", bool(reply1), f"reply={reply1[:120]}")
145
146 # Turn 2
147 session1_messages.append({"role": "assistant", "content": reply1})

Callers 1

Calls 14

startMethod · 0.95
get_statsMethod · 0.95
search_keywordMethod · 0.95
closeMethod · 0.95
stopMethod · 0.95
ConfigStoreClass · 0.90
MetaClawLauncherClass · 0.90
MemoryStoreClass · 0.90
recordFunction · 0.85
wait_for_proxyFunction · 0.70
send_chatFunction · 0.70
infoMethod · 0.45

Tested by

no test coverage detected