Skip to content

Commit 829be84

Browse files
committed
fix tests
Signed-off-by: yaron2 <schneider.yaron@live.com>
1 parent fee200d commit 829be84

3 files changed

Lines changed: 17 additions & 13 deletions

File tree

ext/dapr-ext-crewai/tests/test_models.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
# Tests for data models.
1717

1818
import json
19+
import unittest
1920

2021
from dapr.ext.crewai.models import (
2122
AgentConfig,
@@ -32,7 +33,7 @@
3233
)
3334

3435

35-
class TestToolCall:
36+
class TestToolCall(unittest.TestCase):
3637
def test_to_dict(self):
3738
tc = ToolCall(id='call_123', name='search', args={'query': 'test'})
3839
result = tc.to_dict()
@@ -57,7 +58,7 @@ def test_roundtrip(self):
5758
assert original.args == roundtripped.args
5859

5960

60-
class TestToolResult:
61+
class TestToolResult(unittest.TestCase):
6162
def test_to_dict(self):
6263
tr = ToolResult(
6364
tool_call_id='call_123',
@@ -82,7 +83,7 @@ def test_from_dict_with_error(self):
8283
assert tr.result is None
8384

8485

85-
class TestMessage:
86+
class TestMessage(unittest.TestCase):
8687
def test_user_message(self):
8788
msg = Message(role=MessageRole.USER, content='Hello')
8889
data = msg.to_dict()
@@ -127,7 +128,7 @@ def test_roundtrip(self):
127128
assert len(original.tool_calls) == len(roundtripped.tool_calls)
128129

129130

130-
class TestAgentConfig:
131+
class TestAgentConfig(unittest.TestCase):
131132
def test_to_dict(self):
132133
config = AgentConfig(
133134
role='Research Assistant',
@@ -159,7 +160,7 @@ def test_from_dict(self):
159160
assert config.verbose is True
160161

161162

162-
class TestAgentWorkflowInput:
163+
class TestAgentWorkflowInput(unittest.TestCase):
163164
def test_json_serializable(self):
164165
"""Test that the entire input can be JSON serialized."""
165166
agent_config = AgentConfig(
@@ -189,7 +190,7 @@ def test_json_serializable(self):
189190
assert parsed.agent_config.role == 'Assistant'
190191

191192

192-
class TestAgentWorkflowOutput:
193+
class TestAgentWorkflowOutput(unittest.TestCase):
193194
def test_completed_output(self):
194195
output = AgentWorkflowOutput(
195196
final_response='The answer is 42',
@@ -214,7 +215,7 @@ def test_error_output(self):
214215
assert data['error'] == 'Something went wrong'
215216

216217

217-
class TestCallLlmInput:
218+
class TestCallLlmInput(unittest.TestCase):
218219
def test_to_dict(self):
219220
agent_config = AgentConfig(
220221
role='Assistant',
@@ -237,7 +238,7 @@ def test_to_dict(self):
237238
assert 'messages' in data
238239

239240

240-
class TestExecuteToolInput:
241+
class TestExecuteToolInput(unittest.TestCase):
241242
def test_to_dict(self):
242243
tc = ToolCall(id='call_123', name='search', args={'query': 'test'})
243244
tool_input = ExecuteToolInput(

ext/dapr-ext-crewai/tests/test_workflow.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515

1616
# Tests for workflow and activities.
1717

18+
import unittest
19+
1820
from dapr.ext.crewai.models import (
1921
AgentConfig,
2022
TaskConfig,
@@ -30,8 +32,8 @@
3032
)
3133

3234

33-
class TestToolRegistry:
34-
def setup_method(self):
35+
class TestToolRegistry(unittest.TestCase):
36+
def setUp(self):
3537
"""Clear registry before each test."""
3638
clear_tool_registry()
3739

@@ -63,7 +65,7 @@ def my_tool():
6365
assert get_registered_tool('my_tool') is None
6466

6567

66-
class TestExecuteTool:
68+
class TestExecuteTool(unittest.TestCase):
6769
def test_execute_callable(self):
6870
def add(a: int, b: int) -> int:
6971
return a + b
@@ -99,7 +101,7 @@ def invoke(self, args: dict) -> str:
99101
assert 'invoked with' in result
100102

101103

102-
class TestBuildSystemPrompt:
104+
class TestBuildSystemPrompt(unittest.TestCase):
103105
def test_default_prompt(self):
104106
agent_config = AgentConfig(
105107
role='Research Assistant',

tox.ini

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,12 +112,13 @@ commands_pre =
112112
[testenv:crewai]
113113
basepython = python3
114114
usedevelop = False
115+
deps =
115116
commands =
116117
python -m unittest discover -v ./ext/dapr-ext-crewai/tests
117118
commands_pre =
118119
pip3 install -e {toxinidir}/
119120
pip3 install -e {toxinidir}/ext/dapr-ext-workflow/
120-
pip3 install -e {toxinidir}/ext/dapr-ext-crewai/
121+
pip3 install --no-deps -e {toxinidir}/ext/dapr-ext-crewai/
121122

122123
[testenv:doc]
123124
basepython = python3

0 commit comments

Comments
 (0)