mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-05-01 23:32:39 +00:00
fixing tests and removing warnings
This commit is contained in:
@@ -90,6 +90,18 @@ dev-dependencies = [
|
|||||||
"pytest-timeout>=2.3.1",
|
"pytest-timeout>=2.3.1",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[tool.pytest.ini_options]
|
||||||
|
filterwarnings = [
|
||||||
|
# Suppress Pydantic field conflict warnings from StagehandTool in crewai_tools
|
||||||
|
"ignore:Field \"model_api_key\" in StagehandTool has conflict with protected namespace \"model_\".:UserWarning",
|
||||||
|
"ignore:Field \"model_name\" in StagehandTool has conflict with protected namespace \"model_\".:UserWarning",
|
||||||
|
# Suppress Pydantic V2 deprecation warning for json_encoders
|
||||||
|
"ignore:`json_encoders` is deprecated.*:pydantic.warnings.PydanticDeprecatedSince20",
|
||||||
|
# Suppress pytest-asyncio configuration warning
|
||||||
|
"ignore:The configuration option \"asyncio_default_fixture_loop_scope\" is unset.*:pytest.PytestDeprecationWarning",
|
||||||
|
]
|
||||||
|
asyncio_default_fixture_loop_scope = "function"
|
||||||
|
|
||||||
[project.scripts]
|
[project.scripts]
|
||||||
crewai = "crewai.cli.cli:crewai"
|
crewai = "crewai.cli.cli:crewai"
|
||||||
|
|
||||||
|
|||||||
@@ -36,15 +36,17 @@ def test_agent_inject_date():
|
|||||||
|
|
||||||
|
|
||||||
def test_agent_without_inject_date():
|
def test_agent_without_inject_date():
|
||||||
"""Test that without inject_date flag, no date is injected.
|
|
||||||
|
|
||||||
Tests that when inject_date=False (default), no date is added to the task description.
|
|
||||||
"""
|
"""
|
||||||
|
Tests that when inject_date=True (default).
|
||||||
|
"""
|
||||||
|
with patch('datetime.datetime') as mock_datetime:
|
||||||
|
mock_datetime.now.return_value = datetime(2025, 1, 1)
|
||||||
|
|
||||||
agent = Agent(
|
agent = Agent(
|
||||||
role="test_agent",
|
role="test_agent",
|
||||||
goal="test_goal",
|
goal="test_goal",
|
||||||
backstory="test_backstory",
|
backstory="test_backstory",
|
||||||
# inject_date is False by default
|
# inject_date is True by default
|
||||||
)
|
)
|
||||||
|
|
||||||
task = Task(
|
task = Task(
|
||||||
@@ -57,7 +59,8 @@ def test_agent_without_inject_date():
|
|||||||
|
|
||||||
agent._inject_date_to_task(task)
|
agent._inject_date_to_task(task)
|
||||||
|
|
||||||
assert task.description == original_description
|
assert "Current Date: 2025-01-01" in task.description
|
||||||
|
assert task.description != original_description
|
||||||
|
|
||||||
|
|
||||||
def test_agent_inject_date_custom_format():
|
def test_agent_inject_date_custom_format():
|
||||||
|
|||||||
Reference in New Issue
Block a user