Skip to content

armgit / letta

Public Imported from GitHub
0

Platform for stateful agents: AI with advanced memory that can learn and self-improve over time.

fix: test sdk client fixtures (#4997)

cthomase5d364d04360
diff --git a/tests/test_sdk_client.py b/tests/test_sdk_client.py
index 7b78f3bbd..98b81d05f 100644
--- a/tests/test_sdk_client.py
+++ b/tests/test_sdk_client.py
@@ -1,3 +1,4 @@
+import asyncio
import io
import json
import os
@@ -50,8 +51,7 @@ def run_server():
start_server(debug=True)
-# @pytest.fixture(scope="module")
[email protected](scope="function")
[email protected](scope="module")
def client() -> LettaSDKClient:
# Get URL from environment or start server
server_url = os.getenv("LETTA_SERVER_URL", f"http://localhost:{SERVER_PORT}")
@@ -66,8 +66,8 @@ def client() -> LettaSDKClient:
yield client
[email protected](scope="function")
-async def server():
[email protected](scope="module")
+def server():
"""
Creates a SyncServer instance for testing.
@@ -76,7 +76,7 @@ async def server():
config = LettaConfig.load()
config.save()
server = SyncServer()
- await server.init_async()
+ asyncio.run(server.init_async())
return server
@@ -2250,6 +2250,7 @@ def test_run_list(client: LettaSDKClient):
run = client.runs.retrieve(runs[0].id)
assert run.agent_id == agent.id
+
@pytest.mark.asyncio
async def test_create_batch(client: LettaSDKClient, server: SyncServer):
# create agents