Skip to content

Commit d8e7aec

Browse files
committed
uncomment breaking tests
1 parent cf62e32 commit d8e7aec

File tree

1 file changed

+12
-17
lines changed

1 file changed

+12
-17
lines changed

tests/custom/test_client.py

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import os
22
import pytest
3+
from typing import Generator
34
from letta import (
45
AgentState,
56
CreateBlock,
@@ -13,10 +14,14 @@
1314

1415

1516
@pytest.fixture(scope="session")
16-
def client() -> Letta:
17+
def client() -> Generator[Letta, None, None]:
18+
api_key = os.getenv('LETTA_API_KEY')
19+
if not api_key:
20+
raise ValueError("LETTA_API_KEY environment variable must be set")
21+
1722
client = Letta(
1823
environment=LettaEnvironment.LETTA_HOSTED,
19-
token=os.getenv('LETTA_API_KEY'),
24+
token=api_key,
2025
)
2126
yield client
2227

@@ -48,8 +53,7 @@ def test_create_agent_default(client) -> None:
4853
agents = client.agents.list()
4954
assert len([a for a in agents if a.id == agent.id]) == 1
5055

51-
# TODO: Fix error to enable this line, delete() api has incorrect return type
52-
# client.agents.delete(agent_id=agent.id)
56+
client.agents.delete(agent_id=agent.id)
5357

5458

5559
def test_create_agent_with_handle(client) -> None:
@@ -67,12 +71,9 @@ def test_create_agent_with_handle(client) -> None:
6771
agents = client.agents.list()
6872
assert len([a for a in agents if a.id == agent.id]) == 1
6973

70-
# TODO: Fix error to enable this line, delete() api has incorrect return type
71-
# client.agents.delete(agent_id=agent.id)
74+
client.agents.delete(agent_id=agent.id)
7275

7376

74-
"""
75-
TODO: Fix error to enable this test, from_template field not part of create() api
7677
def test_create_agent_with_template(client) -> None:
7778
agent = client.agents.create(
7879
memory_blocks=[
@@ -87,13 +88,9 @@ def test_create_agent_with_template(client) -> None:
8788
agents = client.agents.list()
8889
assert len([a for a in agents if a.id == agent.id]) == 1
8990

90-
# TODO: Fix error to enable this line, delete() api has incorrect return type
91-
# client.agents.delete(agent_id=agent.id)
92-
"""
91+
client.agents.delete(agent_id=agent.id)
9392

9493

95-
"""
96-
TODO: Fix error to enable this test, delete() api has incorrect return type
9794
def test_delete_agent(client) -> None:
9895
agent = client.agents.create(
9996
memory_blocks=[
@@ -113,11 +110,10 @@ def test_delete_agent(client) -> None:
113110

114111
agents = client.agents.list()
115112
assert len([a for a in agents if a.id == agent.id]) == 0
116-
"""
117113

118114

119115
@pytest.fixture(scope="module")
120-
def agent(client) -> AgentState:
116+
def agent(client) -> Generator[AgentState, None, None]:
121117
agent = client.agents.create(
122118
memory_blocks=[
123119
CreateBlock(
@@ -131,8 +127,7 @@ def agent(client) -> AgentState:
131127

132128
yield agent
133129

134-
# TODO: Fix error to enable this line, delete() api has incorrect return type
135-
# client.agents.delete(agent_id=agent.id)
130+
client.agents.delete(agent_id=agent.id)
136131

137132

138133
def test_send_message(client, agent) -> None:

0 commit comments

Comments
 (0)