repo stringlengths 7 90 | file_url stringlengths 81 315 | file_path stringlengths 4 228 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 14:38:15 2026-01-05 02:33:18 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI/blob/f3c17a249b5a2da3a917784d9762421591c1cde5/lib/crewai/tests/test_flow_persistence.py | lib/crewai/tests/test_flow_persistence.py | """Test flow state persistence functionality."""
import os
from typing import Dict, List
from crewai.flow.flow import Flow, FlowState, listen, start
from crewai.flow.persistence import persist
from crewai.flow.persistence.sqlite import SQLiteFlowPersistence
from pydantic import BaseModel
class TestState(FlowState):... | python | MIT | f3c17a249b5a2da3a917784d9762421591c1cde5 | 2026-01-04T14:39:52.484392Z | false |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI/blob/f3c17a249b5a2da3a917784d9762421591c1cde5/lib/crewai/tests/test_imports.py | lib/crewai/tests/test_imports.py | """Test that all public API classes are properly importable."""
def test_task_output_import():
"""Test that TaskOutput can be imported from crewai."""
from crewai import TaskOutput
assert TaskOutput is not None
def test_crew_output_import():
"""Test that CrewOutput can be imported from crewai."""
... | python | MIT | f3c17a249b5a2da3a917784d9762421591c1cde5 | 2026-01-04T14:39:52.484392Z | false |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI/blob/f3c17a249b5a2da3a917784d9762421591c1cde5/lib/crewai/tests/storage/test_mem0_storage.py | lib/crewai/tests/storage/test_mem0_storage.py | from unittest.mock import MagicMock, patch
import pytest
from crewai.memory.storage.mem0_storage import Mem0Storage
from mem0 import Memory, MemoryClient
# Define the class (if not already defined)
class MockCrew:
def __init__(self):
self.agents = [MagicMock(role="Test Agent")]
# Test data constants
SY... | python | MIT | f3c17a249b5a2da3a917784d9762421591c1cde5 | 2026-01-04T14:39:52.484392Z | false |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI/blob/f3c17a249b5a2da3a917784d9762421591c1cde5/lib/crewai/tests/storage/__init__.py | lib/crewai/tests/storage/__init__.py | """Tests for storage."""
| python | MIT | f3c17a249b5a2da3a917784d9762421591c1cde5 | 2026-01-04T14:39:52.484392Z | false |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI/blob/f3c17a249b5a2da3a917784d9762421591c1cde5/lib/crewai/tests/crew/test_async_crew.py | lib/crewai/tests/crew/test_async_crew.py | """Tests for async crew execution."""
import pytest
from unittest.mock import AsyncMock, MagicMock, patch
from crewai.agent import Agent
from crewai.crew import Crew
from crewai.task import Task
from crewai.crews.crew_output import CrewOutput
from crewai.tasks.task_output import TaskOutput
@pytest.fixture
def test_... | python | MIT | f3c17a249b5a2da3a917784d9762421591c1cde5 | 2026-01-04T14:39:52.484392Z | false |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI/blob/f3c17a249b5a2da3a917784d9762421591c1cde5/lib/crewai/tests/tools/test_base_tool.py | lib/crewai/tests/tools/test_base_tool.py | import asyncio
from typing import Callable
from unittest.mock import patch
import pytest
from crewai.agent import Agent
from crewai.crew import Crew
from crewai.task import Task
from crewai.tools import BaseTool, tool
def test_creating_a_tool_using_annotation():
@tool("Name of my tool")
def my_tool(question:... | python | MIT | f3c17a249b5a2da3a917784d9762421591c1cde5 | 2026-01-04T14:39:52.484392Z | false |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI/blob/f3c17a249b5a2da3a917784d9762421591c1cde5/lib/crewai/tests/tools/test_structured_tool.py | lib/crewai/tests/tools/test_structured_tool.py | import pytest
from pydantic import BaseModel, Field
from crewai.tools.structured_tool import CrewStructuredTool
# Test fixtures
@pytest.fixture
def basic_function():
def test_func(param1: str, param2: int = 0) -> str:
"""Test function with basic params."""
return f"{param1} {param2}"
return ... | python | MIT | f3c17a249b5a2da3a917784d9762421591c1cde5 | 2026-01-04T14:39:52.484392Z | false |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI/blob/f3c17a249b5a2da3a917784d9762421591c1cde5/lib/crewai/tests/tools/test_tool_usage_limit.py | lib/crewai/tests/tools/test_tool_usage_limit.py | import pytest
from unittest.mock import MagicMock
from crewai.tools import BaseTool, tool
from crewai.tools.tool_usage import ToolUsage
def test_tool_usage_limit():
"""Test that tools respect usage limits."""
class LimitedTool(BaseTool):
name: str = "Limited Tool"
description: str = "A tool w... | python | MIT | f3c17a249b5a2da3a917784d9762421591c1cde5 | 2026-01-04T14:39:52.484392Z | false |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI/blob/f3c17a249b5a2da3a917784d9762421591c1cde5/lib/crewai/tests/tools/test_async_tools.py | lib/crewai/tests/tools/test_async_tools.py | """Tests for async tool functionality."""
import asyncio
import pytest
from crewai.tools import BaseTool, tool
class SyncTool(BaseTool):
"""Test tool with synchronous _run method."""
name: str = "sync_tool"
description: str = "A synchronous tool for testing"
def _run(self, input_text: str) -> str... | python | MIT | f3c17a249b5a2da3a917784d9762421591c1cde5 | 2026-01-04T14:39:52.484392Z | false |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI/blob/f3c17a249b5a2da3a917784d9762421591c1cde5/lib/crewai/tests/tools/__init__.py | lib/crewai/tests/tools/__init__.py | """Tests for tools."""
| python | MIT | f3c17a249b5a2da3a917784d9762421591c1cde5 | 2026-01-04T14:39:52.484392Z | false |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI/blob/f3c17a249b5a2da3a917784d9762421591c1cde5/lib/crewai/tests/tools/test_tool_usage.py | lib/crewai/tests/tools/test_tool_usage.py | import datetime
import json
import random
import threading
import time
from unittest.mock import MagicMock, patch
import pytest
from crewai import Agent, Task
from crewai.events.event_bus import crewai_event_bus
from crewai.events.types.tool_usage_events import (
ToolSelectionErrorEvent,
ToolUsageFinishedEvent... | python | MIT | f3c17a249b5a2da3a917784d9762421591c1cde5 | 2026-01-04T14:39:52.484392Z | false |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI/blob/f3c17a249b5a2da3a917784d9762421591c1cde5/lib/crewai/tests/tools/agent_tools/test_agent_tools.py | lib/crewai/tests/tools/agent_tools/test_agent_tools.py | """Test Agent creation and execution basic functionality."""
import os
import pytest
from crewai.agent import Agent
from crewai.tools.agent_tools.agent_tools import AgentTools
researcher = Agent(
role="researcher",
goal="make the best research and analysis on content about AI and AI agents",
backstory="Yo... | python | MIT | f3c17a249b5a2da3a917784d9762421591c1cde5 | 2026-01-04T14:39:52.484392Z | false |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI/blob/f3c17a249b5a2da3a917784d9762421591c1cde5/lib/crewai/tests/tools/agent_tools/__init__.py | lib/crewai/tests/tools/agent_tools/__init__.py | python | MIT | f3c17a249b5a2da3a917784d9762421591c1cde5 | 2026-01-04T14:39:52.484392Z | false | |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI/blob/f3c17a249b5a2da3a917784d9762421591c1cde5/lib/crewai/tests/agents/test_lite_agent.py | lib/crewai/tests/agents/test_lite_agent.py | # mypy: ignore-errors
import threading
from collections import defaultdict
from typing import cast
from unittest.mock import Mock, patch
from crewai.events.event_bus import crewai_event_bus
from crewai.events.types.agent_events import LiteAgentExecutionStartedEvent
from crewai.events.types.tool_usage_events import Too... | python | MIT | f3c17a249b5a2da3a917784d9762421591c1cde5 | 2026-01-04T14:39:52.484392Z | false |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI/blob/f3c17a249b5a2da3a917784d9762421591c1cde5/lib/crewai/tests/agents/test_crew_agent_executor_flow.py | lib/crewai/tests/agents/test_crew_agent_executor_flow.py | """Unit tests for CrewAgentExecutorFlow.
Tests the Flow-based agent executor implementation including state management,
flow methods, routing logic, and error handling.
"""
from unittest.mock import Mock, patch
import pytest
from crewai.experimental.crew_agent_executor_flow import (
AgentReActState,
CrewAge... | python | MIT | f3c17a249b5a2da3a917784d9762421591c1cde5 | 2026-01-04T14:39:52.484392Z | false |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI/blob/f3c17a249b5a2da3a917784d9762421591c1cde5/lib/crewai/tests/agents/test_agent_inject_date.py | lib/crewai/tests/agents/test_agent_inject_date.py | from datetime import datetime
from unittest.mock import patch
from crewai.agent import Agent
from crewai.task import Task
def test_agent_inject_date():
"""Test that the inject_date flag injects the current date into the task.
Tests that when inject_date=True, the current date is added to the task descriptio... | python | MIT | f3c17a249b5a2da3a917784d9762421591c1cde5 | 2026-01-04T14:39:52.484392Z | false |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI/blob/f3c17a249b5a2da3a917784d9762421591c1cde5/lib/crewai/tests/agents/test_agent_reasoning.py | lib/crewai/tests/agents/test_agent_reasoning.py | """Tests for reasoning in agents."""
import json
import pytest
from crewai import Agent, Task
from crewai.llm import LLM
@pytest.fixture
def mock_llm_responses():
"""Fixture for mock LLM responses."""
return {
"ready": "I'll solve this simple math problem.\n\nREADY: I am ready to execute the task.\... | python | MIT | f3c17a249b5a2da3a917784d9762421591c1cde5 | 2026-01-04T14:39:52.484392Z | false |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI/blob/f3c17a249b5a2da3a917784d9762421591c1cde5/lib/crewai/tests/agents/test_a2a_trust_completion_status.py | lib/crewai/tests/agents/test_a2a_trust_completion_status.py | """Test trust_remote_completion_status flag in A2A wrapper."""
from unittest.mock import MagicMock, patch
import pytest
from crewai.a2a.config import A2AConfig
try:
from a2a.types import Message, Role
A2A_SDK_INSTALLED = True
except ImportError:
A2A_SDK_INSTALLED = False
@pytest.mark.skipif(not A2A_S... | python | MIT | f3c17a249b5a2da3a917784d9762421591c1cde5 | 2026-01-04T14:39:52.484392Z | false |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI/blob/f3c17a249b5a2da3a917784d9762421591c1cde5/lib/crewai/tests/agents/test_agent.py | lib/crewai/tests/agents/test_agent.py | """Test Agent creation and execution basic functionality."""
import os
import threading
from unittest import mock
from unittest.mock import MagicMock, patch
from crewai.agents.crew_agent_executor import AgentFinish, CrewAgentExecutor
from crewai.cli.constants import DEFAULT_LLM_MODEL
from crewai.events.event_bus impo... | python | MIT | f3c17a249b5a2da3a917784d9762421591c1cde5 | 2026-01-04T14:39:52.484392Z | true |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI/blob/f3c17a249b5a2da3a917784d9762421591c1cde5/lib/crewai/tests/agents/test_async_agent_executor.py | lib/crewai/tests/agents/test_async_agent_executor.py | """Tests for async agent executor functionality."""
import asyncio
from typing import Any
from unittest.mock import AsyncMock, MagicMock, patch
import pytest
from crewai.agents.crew_agent_executor import CrewAgentExecutor
from crewai.agents.parser import AgentAction, AgentFinish
from crewai.tools.tool_types import T... | python | MIT | f3c17a249b5a2da3a917784d9762421591c1cde5 | 2026-01-04T14:39:52.484392Z | false |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI/blob/f3c17a249b5a2da3a917784d9762421591c1cde5/lib/crewai/tests/agents/test_crew_agent_parser.py | lib/crewai/tests/agents/test_crew_agent_parser.py | import pytest
from crewai.agents import parser
from crewai.agents.parser import (
AgentAction,
AgentFinish,
)
from crewai.agents.parser import (
OutputParserError as OutputParserException,
)
def test_valid_action_parsing_special_characters():
text = "Thought: Let's find the temperature\nAction: search... | python | MIT | f3c17a249b5a2da3a917784d9762421591c1cde5 | 2026-01-04T14:39:52.484392Z | false |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI/blob/f3c17a249b5a2da3a917784d9762421591c1cde5/lib/crewai/tests/agents/__init__.py | lib/crewai/tests/agents/__init__.py | python | MIT | f3c17a249b5a2da3a917784d9762421591c1cde5 | 2026-01-04T14:39:52.484392Z | false | |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI/blob/f3c17a249b5a2da3a917784d9762421591c1cde5/lib/crewai/tests/agents/test_agent_a2a_wrapping.py | lib/crewai/tests/agents/test_agent_a2a_wrapping.py | """Test A2A wrapper is only applied when a2a is passed to Agent."""
from unittest.mock import patch
import pytest
from crewai import Agent
from crewai.a2a.config import A2AConfig
try:
import a2a # noqa: F401
A2A_SDK_INSTALLED = True
except ImportError:
A2A_SDK_INSTALLED = False
def test_agent_withou... | python | MIT | f3c17a249b5a2da3a917784d9762421591c1cde5 | 2026-01-04T14:39:52.484392Z | false |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI/blob/f3c17a249b5a2da3a917784d9762421591c1cde5/lib/crewai/tests/agents/agent_builder/test_base_agent.py | lib/crewai/tests/agents/agent_builder/test_base_agent.py | import hashlib
from typing import Any
from pydantic import BaseModel
from crewai.agents.agent_builder.base_agent import BaseAgent
from crewai.tools.base_tool import BaseTool
class MockAgent(BaseAgent):
def execute_task(
self,
task: Any,
context: str | None = None,
tools: list[Bas... | python | MIT | f3c17a249b5a2da3a917784d9762421591c1cde5 | 2026-01-04T14:39:52.484392Z | false |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI/blob/f3c17a249b5a2da3a917784d9762421591c1cde5/lib/crewai/tests/agents/agent_builder/__init__.py | lib/crewai/tests/agents/agent_builder/__init__.py | """Tests for agent builder."""
| python | MIT | f3c17a249b5a2da3a917784d9762421591c1cde5 | 2026-01-04T14:39:52.484392Z | false |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI/blob/f3c17a249b5a2da3a917784d9762421591c1cde5/lib/crewai/tests/agents/agent_adapters/test_base_tool_adapter.py | lib/crewai/tests/agents/agent_adapters/test_base_tool_adapter.py | from typing import Any, List
from unittest.mock import Mock
import pytest
from crewai.agents.agent_adapters.base_tool_adapter import BaseToolAdapter
from crewai.tools.base_tool import BaseTool
class ConcreteToolAdapter(BaseToolAdapter):
def configure_tools(self, tools: List[BaseTool]) -> None:
self.conv... | python | MIT | f3c17a249b5a2da3a917784d9762421591c1cde5 | 2026-01-04T14:39:52.484392Z | false |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI/blob/f3c17a249b5a2da3a917784d9762421591c1cde5/lib/crewai/tests/agents/agent_adapters/test_base_agent_adapter.py | lib/crewai/tests/agents/agent_adapters/test_base_agent_adapter.py | from typing import Any
import pytest
from crewai.agents.agent_builder.base_agent import BaseAgent
from crewai.agents.agent_adapters.base_agent_adapter import BaseAgentAdapter
from crewai.tools.base_tool import BaseTool
from crewai.agents.agent_builder.utilities.base_token_process import TokenProcess
from pydantic impo... | python | MIT | f3c17a249b5a2da3a917784d9762421591c1cde5 | 2026-01-04T14:39:52.484392Z | false |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI/blob/f3c17a249b5a2da3a917784d9762421591c1cde5/lib/crewai/tests/agents/agent_adapters/__init__.py | lib/crewai/tests/agents/agent_adapters/__init__.py | """Tests for agent adapters."""
| python | MIT | f3c17a249b5a2da3a917784d9762421591c1cde5 | 2026-01-04T14:39:52.484392Z | false |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI/blob/f3c17a249b5a2da3a917784d9762421591c1cde5/lib/crewai/tests/tracing/__init__.py | lib/crewai/tests/tracing/__init__.py | python | MIT | f3c17a249b5a2da3a917784d9762421591c1cde5 | 2026-01-04T14:39:52.484392Z | false | |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI/blob/f3c17a249b5a2da3a917784d9762421591c1cde5/lib/crewai/tests/tracing/test_trace_enable_disable.py | lib/crewai/tests/tracing/test_trace_enable_disable.py | """Tests to verify that traces are sent when enabled and not sent when disabled.
VCR will record HTTP interactions. Inspect cassettes to verify tracing behavior.
"""
import pytest
from crewai import Agent, Crew, Task
from tests.utils import wait_for_event_handlers
class TestTraceEnableDisable:
"""Test suite to ... | python | MIT | f3c17a249b5a2da3a917784d9762421591c1cde5 | 2026-01-04T14:39:52.484392Z | false |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI/blob/f3c17a249b5a2da3a917784d9762421591c1cde5/lib/crewai/tests/tracing/test_tracing.py | lib/crewai/tests/tracing/test_tracing.py | import os
from unittest.mock import MagicMock, Mock, patch
import pytest
from crewai import Agent, Crew, Task
from crewai.events.listeners.tracing.first_time_trace_handler import (
FirstTimeTraceHandler,
)
from crewai.events.listeners.tracing.trace_batch_manager import (
TraceBatchManager,
)
from crewai.events... | python | MIT | f3c17a249b5a2da3a917784d9762421591c1cde5 | 2026-01-04T14:39:52.484392Z | false |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI/blob/f3c17a249b5a2da3a917784d9762421591c1cde5/lib/crewai/tests/rag/__init__.py | lib/crewai/tests/rag/__init__.py | python | MIT | f3c17a249b5a2da3a917784d9762421591c1cde5 | 2026-01-04T14:39:52.484392Z | false | |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI/blob/f3c17a249b5a2da3a917784d9762421591c1cde5/lib/crewai/tests/rag/test_rag_storage_path.py | lib/crewai/tests/rag/test_rag_storage_path.py | """Tests for RAGStorage custom path functionality."""
from unittest.mock import MagicMock, patch
from crewai.memory.storage.rag_storage import RAGStorage
@patch("crewai.memory.storage.rag_storage.create_client")
@patch("crewai.memory.storage.rag_storage.build_embedder")
def test_rag_storage_custom_path(
mock_bu... | python | MIT | f3c17a249b5a2da3a917784d9762421591c1cde5 | 2026-01-04T14:39:52.484392Z | false |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI/blob/f3c17a249b5a2da3a917784d9762421591c1cde5/lib/crewai/tests/rag/test_error_handling.py | lib/crewai/tests/rag/test_error_handling.py | """Tests for RAG client error handling scenarios."""
from unittest.mock import MagicMock, patch
import pytest
from crewai.knowledge.storage.knowledge_storage import ( # type: ignore[import-untyped]
KnowledgeStorage,
)
from crewai.memory.storage.rag_storage import RAGStorage # type: ignore[import-untyped]
@pat... | python | MIT | f3c17a249b5a2da3a917784d9762421591c1cde5 | 2026-01-04T14:39:52.484392Z | false |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI/blob/f3c17a249b5a2da3a917784d9762421591c1cde5/lib/crewai/tests/rag/qdrant/test_client.py | lib/crewai/tests/rag/qdrant/test_client.py | """Tests for QdrantClient implementation."""
from unittest.mock import AsyncMock, Mock
import pytest
from crewai.rag.core.exceptions import ClientMethodMismatchError
from crewai.rag.qdrant.client import QdrantClient
from crewai.rag.types import BaseRecord
from qdrant_client import AsyncQdrantClient
from qdrant_client... | python | MIT | f3c17a249b5a2da3a917784d9762421591c1cde5 | 2026-01-04T14:39:52.484392Z | false |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI/blob/f3c17a249b5a2da3a917784d9762421591c1cde5/lib/crewai/tests/rag/chromadb/test_utils.py | lib/crewai/tests/rag/chromadb/test_utils.py | """Tests for ChromaDB utility functions."""
from crewai.rag.chromadb.types import PreparedDocuments
from crewai.rag.chromadb.utils import (
MAX_COLLECTION_LENGTH,
MIN_COLLECTION_LENGTH,
_create_batch_slice,
_is_ipv4_pattern,
_prepare_documents_for_chromadb,
_sanitize_collection_name,
)
from cre... | python | MIT | f3c17a249b5a2da3a917784d9762421591c1cde5 | 2026-01-04T14:39:52.484392Z | false |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI/blob/f3c17a249b5a2da3a917784d9762421591c1cde5/lib/crewai/tests/rag/chromadb/__init__.py | lib/crewai/tests/rag/chromadb/__init__.py | python | MIT | f3c17a249b5a2da3a917784d9762421591c1cde5 | 2026-01-04T14:39:52.484392Z | false | |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI/blob/f3c17a249b5a2da3a917784d9762421591c1cde5/lib/crewai/tests/rag/chromadb/test_client.py | lib/crewai/tests/rag/chromadb/test_client.py | """Tests for ChromaDBClient implementation."""
from unittest.mock import AsyncMock, Mock
import pytest
from crewai.rag.chromadb.client import ChromaDBClient
from crewai.rag.types import BaseRecord
@pytest.fixture
def mock_chromadb_client():
"""Create a mock ChromaDB client."""
from chromadb.api import Clien... | python | MIT | f3c17a249b5a2da3a917784d9762421591c1cde5 | 2026-01-04T14:39:52.484392Z | false |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI/blob/f3c17a249b5a2da3a917784d9762421591c1cde5/lib/crewai/tests/rag/config/test_factory.py | lib/crewai/tests/rag/config/test_factory.py | """Tests for RAG config factory."""
from unittest.mock import Mock, patch
import pytest
from crewai.rag.factory import create_client
def test_create_client_chromadb():
"""Test ChromaDB client creation."""
mock_config = Mock()
mock_config.provider = "chromadb"
with patch("crewai.rag.factory.require"... | python | MIT | f3c17a249b5a2da3a917784d9762421591c1cde5 | 2026-01-04T14:39:52.484392Z | false |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI/blob/f3c17a249b5a2da3a917784d9762421591c1cde5/lib/crewai/tests/rag/config/test_optional_imports.py | lib/crewai/tests/rag/config/test_optional_imports.py | """Tests for optional imports."""
import pytest
from crewai.rag.config.optional_imports.base import _MissingProvider
from crewai.rag.config.optional_imports.providers import MissingChromaDBConfig
def test_missing_provider_raises_runtime_error():
"""Test that _MissingProvider raises RuntimeError on instantiation.... | python | MIT | f3c17a249b5a2da3a917784d9762421591c1cde5 | 2026-01-04T14:39:52.484392Z | false |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI/blob/f3c17a249b5a2da3a917784d9762421591c1cde5/lib/crewai/tests/rag/embeddings/test_backward_compatibility.py | lib/crewai/tests/rag/embeddings/test_backward_compatibility.py | """Tests for backward compatibility of embedding provider configurations."""
from crewai.rag.embeddings.factory import build_embedder, PROVIDER_PATHS
from crewai.rag.embeddings.providers.openai.openai_provider import OpenAIProvider
from crewai.rag.embeddings.providers.cohere.cohere_provider import CohereProvider
from ... | python | MIT | f3c17a249b5a2da3a917784d9762421591c1cde5 | 2026-01-04T14:39:52.484392Z | false |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI/blob/f3c17a249b5a2da3a917784d9762421591c1cde5/lib/crewai/tests/rag/embeddings/test_factory_azure.py | lib/crewai/tests/rag/embeddings/test_factory_azure.py | """Test Azure embedder configuration with factory."""
from unittest.mock import MagicMock, patch
import pytest
from crewai.rag.embeddings.factory import build_embedder
class TestAzureEmbedderFactory:
"""Test Azure embedder configuration with factory function."""
@patch("crewai.rag.embeddings.factory.impor... | python | MIT | f3c17a249b5a2da3a917784d9762421591c1cde5 | 2026-01-04T14:39:52.484392Z | false |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI/blob/f3c17a249b5a2da3a917784d9762421591c1cde5/lib/crewai/tests/rag/embeddings/test_embedding_factory.py | lib/crewai/tests/rag/embeddings/test_embedding_factory.py | """Tests for embedding function factory."""
from unittest.mock import MagicMock, patch
import pytest
from crewai.rag.embeddings.factory import build_embedder
class TestEmbeddingFactory:
"""Test embedding factory functions."""
@patch("crewai.rag.embeddings.factory.import_and_validate_definition")
def t... | python | MIT | f3c17a249b5a2da3a917784d9762421591c1cde5 | 2026-01-04T14:39:52.484392Z | false |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI/blob/f3c17a249b5a2da3a917784d9762421591c1cde5/lib/crewai/tests/knowledge/test_knowledge.py | lib/crewai/tests/knowledge/test_knowledge.py | """Test Knowledge creation and querying functionality."""
from pathlib import Path
from unittest.mock import patch
import pytest
from crewai.knowledge.source.crew_docling_source import CrewDoclingSource
from crewai.knowledge.source.csv_knowledge_source import CSVKnowledgeSource
from crewai.knowledge.source.excel_know... | python | MIT | f3c17a249b5a2da3a917784d9762421591c1cde5 | 2026-01-04T14:39:52.484392Z | false |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI/blob/f3c17a249b5a2da3a917784d9762421591c1cde5/lib/crewai/tests/knowledge/test_async_knowledge.py | lib/crewai/tests/knowledge/test_async_knowledge.py | """Tests for async knowledge operations."""
from unittest.mock import AsyncMock, MagicMock, patch
import pytest
from crewai.knowledge.knowledge import Knowledge
from crewai.knowledge.source.string_knowledge_source import StringKnowledgeSource
from crewai.knowledge.storage.knowledge_storage import KnowledgeStorage
... | python | MIT | f3c17a249b5a2da3a917784d9762421591c1cde5 | 2026-01-04T14:39:52.484392Z | false |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI/blob/f3c17a249b5a2da3a917784d9762421591c1cde5/lib/crewai/tests/knowledge/test_knowledge_storage_integration.py | lib/crewai/tests/knowledge/test_knowledge_storage_integration.py | """Integration tests for KnowledgeStorage RAG client migration."""
from unittest.mock import MagicMock, patch
import pytest
from crewai.knowledge.storage.knowledge_storage import ( # type: ignore[import-untyped]
KnowledgeStorage,
)
@patch("crewai.knowledge.storage.knowledge_storage.get_rag_client")
@patch("cre... | python | MIT | f3c17a249b5a2da3a917784d9762421591c1cde5 | 2026-01-04T14:39:52.484392Z | false |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI/blob/f3c17a249b5a2da3a917784d9762421591c1cde5/lib/crewai/tests/knowledge/__init__.py | lib/crewai/tests/knowledge/__init__.py | python | MIT | f3c17a249b5a2da3a917784d9762421591c1cde5 | 2026-01-04T14:39:52.484392Z | false | |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI/blob/f3c17a249b5a2da3a917784d9762421591c1cde5/lib/crewai/tests/knowledge/test_knowledge_searchresult.py | lib/crewai/tests/knowledge/test_knowledge_searchresult.py | """Tests for Knowledge SearchResult type conversion and integration."""
from typing import Any
from unittest.mock import MagicMock, patch
import pytest
from crewai.knowledge.knowledge import Knowledge # type: ignore[import-untyped]
from crewai.knowledge.source.string_knowledge_source import ( # type: ignore[import-... | python | MIT | f3c17a249b5a2da3a917784d9762421591c1cde5 | 2026-01-04T14:39:52.484392Z | false |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI/blob/f3c17a249b5a2da3a917784d9762421591c1cde5/lib/crewai/tests/hooks/test_crew_scoped_hooks.py | lib/crewai/tests/hooks/test_crew_scoped_hooks.py | """Tests for crew-scoped hooks within @CrewBase classes."""
from __future__ import annotations
from unittest.mock import Mock
import pytest
from crewai import Agent, Crew
from crewai.hooks import (
LLMCallHookContext,
ToolCallHookContext,
before_llm_call,
before_tool_call,
get_before_llm_call_ho... | python | MIT | f3c17a249b5a2da3a917784d9762421591c1cde5 | 2026-01-04T14:39:52.484392Z | false |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI/blob/f3c17a249b5a2da3a917784d9762421591c1cde5/lib/crewai/tests/hooks/test_decorators.py | lib/crewai/tests/hooks/test_decorators.py | """Tests for decorator-based hook registration."""
from __future__ import annotations
from unittest.mock import Mock
import pytest
from crewai.hooks import (
after_llm_call,
after_tool_call,
before_llm_call,
before_tool_call,
get_after_llm_call_hooks,
get_after_tool_call_hooks,
get_befor... | python | MIT | f3c17a249b5a2da3a917784d9762421591c1cde5 | 2026-01-04T14:39:52.484392Z | false |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI/blob/f3c17a249b5a2da3a917784d9762421591c1cde5/lib/crewai/tests/hooks/test_llm_hooks.py | lib/crewai/tests/hooks/test_llm_hooks.py | """Unit tests for LLM hooks functionality."""
from __future__ import annotations
from unittest.mock import Mock
from crewai.hooks import clear_all_llm_call_hooks, unregister_after_llm_call_hook, unregister_before_llm_call_hook
import pytest
from crewai.hooks.llm_hooks import (
LLMCallHookContext,
get_after_... | python | MIT | f3c17a249b5a2da3a917784d9762421591c1cde5 | 2026-01-04T14:39:52.484392Z | false |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI/blob/f3c17a249b5a2da3a917784d9762421591c1cde5/lib/crewai/tests/hooks/test_human_approval.py | lib/crewai/tests/hooks/test_human_approval.py | """Tests for human approval functionality in hooks."""
from __future__ import annotations
from unittest.mock import Mock, patch
from crewai.hooks.llm_hooks import LLMCallHookContext
from crewai.hooks.tool_hooks import ToolCallHookContext
import pytest
@pytest.fixture
def mock_executor():
"""Create a mock execu... | python | MIT | f3c17a249b5a2da3a917784d9762421591c1cde5 | 2026-01-04T14:39:52.484392Z | false |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI/blob/f3c17a249b5a2da3a917784d9762421591c1cde5/lib/crewai/tests/hooks/__init__.py | lib/crewai/tests/hooks/__init__.py | """Tests for CrewAI hooks functionality."""
| python | MIT | f3c17a249b5a2da3a917784d9762421591c1cde5 | 2026-01-04T14:39:52.484392Z | false |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI/blob/f3c17a249b5a2da3a917784d9762421591c1cde5/lib/crewai/tests/hooks/test_tool_hooks.py | lib/crewai/tests/hooks/test_tool_hooks.py | from __future__ import annotations
from unittest.mock import Mock
from crewai.hooks import clear_all_tool_call_hooks, unregister_after_tool_call_hook, unregister_before_tool_call_hook
import pytest
from crewai.hooks.tool_hooks import (
ToolCallHookContext,
get_after_tool_call_hooks,
get_before_tool_call_... | python | MIT | f3c17a249b5a2da3a917784d9762421591c1cde5 | 2026-01-04T14:39:52.484392Z | false |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI/blob/f3c17a249b5a2da3a917784d9762421591c1cde5/lib/crewai/tests/memory/test_long_term_memory.py | lib/crewai/tests/memory/test_long_term_memory.py | import threading
from collections import defaultdict
from unittest.mock import ANY
import pytest
from crewai.events.event_bus import crewai_event_bus
from crewai.events.types.memory_events import (
MemoryQueryCompletedEvent,
MemoryQueryStartedEvent,
MemorySaveCompletedEvent,
MemorySaveStartedEvent,
)
... | python | MIT | f3c17a249b5a2da3a917784d9762421591c1cde5 | 2026-01-04T14:39:52.484392Z | false |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI/blob/f3c17a249b5a2da3a917784d9762421591c1cde5/lib/crewai/tests/memory/test_external_memory.py | lib/crewai/tests/memory/test_external_memory.py | import threading
from collections import defaultdict
from unittest.mock import ANY, MagicMock, patch
import pytest
from mem0.memory.main import Memory
from crewai.agent import Agent
from crewai.crew import Crew, Process
from crewai.events.event_bus import crewai_event_bus
from crewai.events.types.memory_events import... | python | MIT | f3c17a249b5a2da3a917784d9762421591c1cde5 | 2026-01-04T14:39:52.484392Z | false |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI/blob/f3c17a249b5a2da3a917784d9762421591c1cde5/lib/crewai/tests/memory/__init__.py | lib/crewai/tests/memory/__init__.py | """Tests for memory."""
| python | MIT | f3c17a249b5a2da3a917784d9762421591c1cde5 | 2026-01-04T14:39:52.484392Z | false |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI/blob/f3c17a249b5a2da3a917784d9762421591c1cde5/lib/crewai/tests/memory/test_short_term_memory.py | lib/crewai/tests/memory/test_short_term_memory.py | import threading
from collections import defaultdict
from unittest.mock import ANY, patch
import pytest
from crewai.agent import Agent
from crewai.crew import Crew
from crewai.events.event_bus import crewai_event_bus
from crewai.events.types.memory_events import (
MemoryQueryCompletedEvent,
MemoryQueryStartedE... | python | MIT | f3c17a249b5a2da3a917784d9762421591c1cde5 | 2026-01-04T14:39:52.484392Z | false |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI/blob/f3c17a249b5a2da3a917784d9762421591c1cde5/lib/crewai/tests/memory/test_async_memory.py | lib/crewai/tests/memory/test_async_memory.py | """Tests for async memory operations."""
import threading
from collections import defaultdict
from unittest.mock import ANY, AsyncMock, MagicMock, patch
import pytest
from crewai.agent import Agent
from crewai.crew import Crew
from crewai.events.event_bus import crewai_event_bus
from crewai.events.types.memory_event... | python | MIT | f3c17a249b5a2da3a917784d9762421591c1cde5 | 2026-01-04T14:39:52.484392Z | false |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI/blob/f3c17a249b5a2da3a917784d9762421591c1cde5/lib/crewai/tests/project/test_callback_with_taskoutput.py | lib/crewai/tests/project/test_callback_with_taskoutput.py | """Test callback decorator with TaskOutput arguments."""
from unittest.mock import MagicMock, patch
from crewai import Agent, Crew, Task
from crewai.project import CrewBase, callback, task
from crewai.tasks.output_format import OutputFormat
from crewai.tasks.task_output import TaskOutput
def test_callback_decorator... | python | MIT | f3c17a249b5a2da3a917784d9762421591c1cde5 | 2026-01-04T14:39:52.484392Z | false |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI/blob/f3c17a249b5a2da3a917784d9762421591c1cde5/lib/crewai/tests/llms/__init__.py | lib/crewai/tests/llms/__init__.py | python | MIT | f3c17a249b5a2da3a917784d9762421591c1cde5 | 2026-01-04T14:39:52.484392Z | false | |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI/blob/f3c17a249b5a2da3a917784d9762421591c1cde5/lib/crewai/tests/llms/openai/test_openai.py | lib/crewai/tests/llms/openai/test_openai.py | import os
import sys
import types
from unittest.mock import patch, MagicMock
import openai
import pytest
from crewai.llm import LLM
from crewai.llms.providers.openai.completion import OpenAICompletion
from crewai.crew import Crew
from crewai.agent import Agent
from crewai.task import Task
from crewai.cli.constants imp... | python | MIT | f3c17a249b5a2da3a917784d9762421591c1cde5 | 2026-01-04T14:39:52.484392Z | false |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI/blob/f3c17a249b5a2da3a917784d9762421591c1cde5/lib/crewai/tests/llms/openai/test_openai_async.py | lib/crewai/tests/llms/openai/test_openai_async.py | """Tests for OpenAI async completion functionality."""
import pytest
import tiktoken
from crewai import Agent, Task, Crew
from crewai.llm import LLM
@pytest.mark.vcr()
@pytest.mark.asyncio
async def test_openai_async_basic_call():
"""Test basic async call with OpenAI."""
llm = LLM(model="gpt-4o-mini")
... | python | MIT | f3c17a249b5a2da3a917784d9762421591c1cde5 | 2026-01-04T14:39:52.484392Z | false |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI/blob/f3c17a249b5a2da3a917784d9762421591c1cde5/lib/crewai/tests/llms/azure/test_azure_async.py | lib/crewai/tests/llms/azure/test_azure_async.py | """Tests for Azure async completion functionality."""
import pytest
import tiktoken
from crewai import Agent, Task, Crew
from crewai.llm import LLM
@pytest.mark.vcr()
@pytest.mark.asyncio
async def test_azure_async_non_streaming():
"""Test basic async non-streaming call."""
llm = LLM(model="azure/gpt-4o-min... | python | MIT | f3c17a249b5a2da3a917784d9762421591c1cde5 | 2026-01-04T14:39:52.484392Z | false |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI/blob/f3c17a249b5a2da3a917784d9762421591c1cde5/lib/crewai/tests/llms/azure/test_azure.py | lib/crewai/tests/llms/azure/test_azure.py | import os
import sys
import types
from unittest.mock import patch, MagicMock, Mock
import pytest
from crewai.llm import LLM
from crewai.crew import Crew
from crewai.agent import Agent
from crewai.task import Task
@pytest.fixture
def mock_azure_credentials():
"""Mock Azure credentials for tests that need them."""... | python | MIT | f3c17a249b5a2da3a917784d9762421591c1cde5 | 2026-01-04T14:39:52.484392Z | true |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI/blob/f3c17a249b5a2da3a917784d9762421591c1cde5/lib/crewai/tests/llms/azure/__init__.py | lib/crewai/tests/llms/azure/__init__.py | # Azure LLM tests
| python | MIT | f3c17a249b5a2da3a917784d9762421591c1cde5 | 2026-01-04T14:39:52.484392Z | false |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI/blob/f3c17a249b5a2da3a917784d9762421591c1cde5/lib/crewai/tests/llms/hooks/test_transport.py | lib/crewai/tests/llms/hooks/test_transport.py | """Tests for transport layer with interceptor integration."""
from unittest.mock import Mock
import httpx
import pytest
from crewai.llms.hooks.base import BaseInterceptor
from crewai.llms.hooks.transport import AsyncHTTPTransport, HTTPTransport
class TrackingInterceptor(BaseInterceptor[httpx.Request, httpx.Respons... | python | MIT | f3c17a249b5a2da3a917784d9762421591c1cde5 | 2026-01-04T14:39:52.484392Z | false |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI/blob/f3c17a249b5a2da3a917784d9762421591c1cde5/lib/crewai/tests/llms/hooks/test_unsupported_providers.py | lib/crewai/tests/llms/hooks/test_unsupported_providers.py | """Tests for interceptor behavior with unsupported providers."""
import os
import httpx
import pytest
from crewai.llm import LLM
from crewai.llms.hooks.base import BaseInterceptor
@pytest.fixture(autouse=True)
def setup_provider_api_keys(monkeypatch):
"""Set dummy API keys for providers that require them."""
... | python | MIT | f3c17a249b5a2da3a917784d9762421591c1cde5 | 2026-01-04T14:39:52.484392Z | false |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI/blob/f3c17a249b5a2da3a917784d9762421591c1cde5/lib/crewai/tests/llms/hooks/test_openai_interceptor.py | lib/crewai/tests/llms/hooks/test_openai_interceptor.py | """Tests for OpenAI provider with interceptor integration."""
import httpx
import pytest
from crewai.llm import LLM
from crewai.llms.hooks.base import BaseInterceptor
class OpenAITestInterceptor(BaseInterceptor[httpx.Request, httpx.Response]):
"""Test interceptor for OpenAI provider."""
def __init__(self) ... | python | MIT | f3c17a249b5a2da3a917784d9762421591c1cde5 | 2026-01-04T14:39:52.484392Z | false |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI/blob/f3c17a249b5a2da3a917784d9762421591c1cde5/lib/crewai/tests/llms/hooks/test_base_interceptor.py | lib/crewai/tests/llms/hooks/test_base_interceptor.py | """Tests for base interceptor functionality."""
import httpx
import pytest
from crewai.llms.hooks.base import BaseInterceptor
class SimpleInterceptor(BaseInterceptor[httpx.Request, httpx.Response]):
"""Simple test interceptor implementation."""
def __init__(self) -> None:
"""Initialize tracking lis... | python | MIT | f3c17a249b5a2da3a917784d9762421591c1cde5 | 2026-01-04T14:39:52.484392Z | false |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI/blob/f3c17a249b5a2da3a917784d9762421591c1cde5/lib/crewai/tests/llms/hooks/__init__.py | lib/crewai/tests/llms/hooks/__init__.py | """Tests for LLM interceptor hooks functionality."""
| python | MIT | f3c17a249b5a2da3a917784d9762421591c1cde5 | 2026-01-04T14:39:52.484392Z | false |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI/blob/f3c17a249b5a2da3a917784d9762421591c1cde5/lib/crewai/tests/llms/hooks/test_anthropic_interceptor.py | lib/crewai/tests/llms/hooks/test_anthropic_interceptor.py | """Tests for Anthropic provider with interceptor integration."""
import os
import httpx
import pytest
from crewai.llm import LLM
from crewai.llms.hooks.base import BaseInterceptor
@pytest.fixture(autouse=True)
def setup_anthropic_api_key(monkeypatch):
"""Set dummy Anthropic API key for tests that don't make re... | python | MIT | f3c17a249b5a2da3a917784d9762421591c1cde5 | 2026-01-04T14:39:52.484392Z | false |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI/blob/f3c17a249b5a2da3a917784d9762421591c1cde5/lib/crewai/tests/llms/bedrock/test_bedrock.py | lib/crewai/tests/llms/bedrock/test_bedrock.py | import os
import sys
import types
from unittest.mock import patch, MagicMock
import pytest
from crewai.llm import LLM
from crewai.crew import Crew
from crewai.agent import Agent
from crewai.task import Task
@pytest.fixture(autouse=True)
def mock_aws_credentials():
"""Automatically mock AWS credentials and boto3 ... | python | MIT | f3c17a249b5a2da3a917784d9762421591c1cde5 | 2026-01-04T14:39:52.484392Z | false |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI/blob/f3c17a249b5a2da3a917784d9762421591c1cde5/lib/crewai/tests/llms/bedrock/test_bedrock_async.py | lib/crewai/tests/llms/bedrock/test_bedrock_async.py | """Tests for Bedrock async completion functionality.
Note: These tests are skipped in CI because VCR.py does not support
aiobotocore's HTTP session. The cassettes were recorded locally but
cannot be played back properly in CI.
"""
import pytest
import tiktoken
from crewai.llm import LLM
SKIP_REASON = "VCR does not ... | python | MIT | f3c17a249b5a2da3a917784d9762421591c1cde5 | 2026-01-04T14:39:52.484392Z | false |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI/blob/f3c17a249b5a2da3a917784d9762421591c1cde5/lib/crewai/tests/llms/anthropic/test_anthropic_async.py | lib/crewai/tests/llms/anthropic/test_anthropic_async.py | """Tests for Anthropic async completion functionality."""
import json
import logging
import pytest
import tiktoken
from pydantic import BaseModel
from crewai.llm import LLM
from crewai.llms.providers.anthropic.completion import AnthropicCompletion
@pytest.mark.vcr()
@pytest.mark.asyncio
async def test_anthropic_asy... | python | MIT | f3c17a249b5a2da3a917784d9762421591c1cde5 | 2026-01-04T14:39:52.484392Z | false |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI/blob/f3c17a249b5a2da3a917784d9762421591c1cde5/lib/crewai/tests/llms/anthropic/test_anthropic.py | lib/crewai/tests/llms/anthropic/test_anthropic.py | import os
import sys
import types
from unittest.mock import patch, MagicMock
import pytest
from crewai.llm import LLM
from crewai.crew import Crew
from crewai.agent import Agent
from crewai.task import Task
@pytest.fixture(autouse=True)
def mock_anthropic_api_key():
"""Automatically mock ANTHROPIC_API_KEY for al... | python | MIT | f3c17a249b5a2da3a917784d9762421591c1cde5 | 2026-01-04T14:39:52.484392Z | false |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI/blob/f3c17a249b5a2da3a917784d9762421591c1cde5/lib/crewai/tests/llms/google/test_google.py | lib/crewai/tests/llms/google/test_google.py | import os
import sys
import types
from unittest.mock import patch, MagicMock
import pytest
from crewai.llm import LLM
from crewai.crew import Crew
from crewai.agent import Agent
from crewai.task import Task
@pytest.fixture(autouse=True)
def mock_google_api_key():
"""Automatically mock GOOGLE_API_KEY for all test... | python | MIT | f3c17a249b5a2da3a917784d9762421591c1cde5 | 2026-01-04T14:39:52.484392Z | false |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI/blob/f3c17a249b5a2da3a917784d9762421591c1cde5/lib/crewai/tests/llms/google/test_google_async.py | lib/crewai/tests/llms/google/test_google_async.py | """Tests for Google (Gemini) async completion functionality."""
import pytest
import tiktoken
from crewai import Agent, Task, Crew
from crewai.llm import LLM
from crewai.llms.providers.gemini.completion import GeminiCompletion
@pytest.mark.vcr()
@pytest.mark.asyncio
async def test_gemini_async_basic_call():
"""... | python | MIT | f3c17a249b5a2da3a917784d9762421591c1cde5 | 2026-01-04T14:39:52.484392Z | false |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI/blob/f3c17a249b5a2da3a917784d9762421591c1cde5/lib/crewai/tests/llms/litellm/test_litellm_async.py | lib/crewai/tests/llms/litellm/test_litellm_async.py | """Tests for LiteLLM fallback async completion functionality."""
import pytest
import tiktoken
from crewai.llm import LLM
@pytest.mark.asyncio
@pytest.mark.vcr
@pytest.mark.skip(reason="cassettes do not read properly but were generated correctly.")
async def test_litellm_async_basic_call():
"""Test basic async ... | python | MIT | f3c17a249b5a2da3a917784d9762421591c1cde5 | 2026-01-04T14:39:52.484392Z | false |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI/blob/f3c17a249b5a2da3a917784d9762421591c1cde5/lib/crewai/tests/llms/litellm/__init__.py | lib/crewai/tests/llms/litellm/__init__.py | """LiteLLM fallback tests."""
| python | MIT | f3c17a249b5a2da3a917784d9762421591c1cde5 | 2026-01-04T14:39:52.484392Z | false |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI/blob/f3c17a249b5a2da3a917784d9762421591c1cde5/lib/crewai/tests/events/test_depends.py | lib/crewai/tests/events/test_depends.py | """Tests for FastAPI-style dependency injection in event handlers."""
import asyncio
import pytest
from crewai.events import Depends, crewai_event_bus
from crewai.events.base_events import BaseEvent
class DependsTestEvent(BaseEvent):
"""Test event for dependency tests."""
value: int = 0
type: str = "t... | python | MIT | f3c17a249b5a2da3a917784d9762421591c1cde5 | 2026-01-04T14:39:52.484392Z | false |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI/blob/f3c17a249b5a2da3a917784d9762421591c1cde5/lib/crewai/tests/events/test_tracing_utils_machine_id.py | lib/crewai/tests/events/test_tracing_utils_machine_id.py | """Tests for the machine ID generation functionality in tracing utils."""
from pathlib import Path
from unittest.mock import patch
from crewai.events.listeners.tracing.utils import (
_get_generic_system_id,
_get_linux_machine_id,
_get_machine_id,
)
def test_get_machine_id_basic():
"""Test that _get_... | python | MIT | f3c17a249b5a2da3a917784d9762421591c1cde5 | 2026-01-04T14:39:52.484392Z | false |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI/blob/f3c17a249b5a2da3a917784d9762421591c1cde5/lib/crewai/tests/events/types/test_system_events.py | lib/crewai/tests/events/types/test_system_events.py | """Tests for system signal events."""
import signal
from unittest.mock import MagicMock, patch
import pytest
from crewai.events.event_bus import crewai_event_bus
from crewai.events.types.system_events import (
SIGNAL_EVENT_TYPES,
SignalEvent,
SignalType,
SigContEvent,
SigHupEvent,
SigIntEvent... | python | MIT | f3c17a249b5a2da3a917784d9762421591c1cde5 | 2026-01-04T14:39:52.484392Z | false |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI/blob/f3c17a249b5a2da3a917784d9762421591c1cde5/lib/crewai/tests/security/test_security_config.py | lib/crewai/tests/security/test_security_config.py | """Test for the SecurityConfig class."""
import json
from datetime import datetime
from crewai.security import Fingerprint, SecurityConfig
def test_security_config_creation_with_defaults():
"""Test creating a SecurityConfig with default values."""
config = SecurityConfig()
# Check default values
as... | python | MIT | f3c17a249b5a2da3a917784d9762421591c1cde5 | 2026-01-04T14:39:52.484392Z | false |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI/blob/f3c17a249b5a2da3a917784d9762421591c1cde5/lib/crewai/tests/security/__init__.py | lib/crewai/tests/security/__init__.py | python | MIT | f3c17a249b5a2da3a917784d9762421591c1cde5 | 2026-01-04T14:39:52.484392Z | false | |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI/blob/f3c17a249b5a2da3a917784d9762421591c1cde5/lib/crewai/tests/security/test_examples.py | lib/crewai/tests/security/test_examples.py | """Test for the examples in the fingerprinting documentation."""
from crewai import Agent, Crew, Task
from crewai.security import Fingerprint, SecurityConfig
def test_basic_usage_examples():
"""Test the basic usage examples from the documentation."""
# Creating components with automatic fingerprinting
ag... | python | MIT | f3c17a249b5a2da3a917784d9762421591c1cde5 | 2026-01-04T14:39:52.484392Z | false |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI/blob/f3c17a249b5a2da3a917784d9762421591c1cde5/lib/crewai/tests/security/test_deterministic_fingerprints.py | lib/crewai/tests/security/test_deterministic_fingerprints.py | """Tests for deterministic fingerprints in CrewAI components."""
from datetime import datetime
import pytest
from crewai import Agent, Crew, Task
from crewai.security import Fingerprint, SecurityConfig
def test_basic_deterministic_fingerprint():
"""Test that deterministic fingerprints can be created with a see... | python | MIT | f3c17a249b5a2da3a917784d9762421591c1cde5 | 2026-01-04T14:39:52.484392Z | false |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI/blob/f3c17a249b5a2da3a917784d9762421591c1cde5/lib/crewai/tests/security/test_fingerprint.py | lib/crewai/tests/security/test_fingerprint.py | """Test for the Fingerprint class."""
import json
import uuid
from datetime import datetime, timedelta
import pytest
from crewai.security import Fingerprint
def test_fingerprint_creation_with_defaults():
"""Test creating a Fingerprint with default values."""
fingerprint = Fingerprint()
# Check that a U... | python | MIT | f3c17a249b5a2da3a917784d9762421591c1cde5 | 2026-01-04T14:39:52.484392Z | false |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI/blob/f3c17a249b5a2da3a917784d9762421591c1cde5/lib/crewai/tests/security/test_integration.py | lib/crewai/tests/security/test_integration.py | """Test integration of fingerprinting with Agent, Crew, and Task classes."""
from crewai import Agent, Crew, Task
from crewai.security import Fingerprint, SecurityConfig
def test_agent_with_security_config():
"""Test creating an Agent with a SecurityConfig."""
# Create agent with SecurityConfig
security_... | python | MIT | f3c17a249b5a2da3a917784d9762421591c1cde5 | 2026-01-04T14:39:52.484392Z | false |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI/blob/f3c17a249b5a2da3a917784d9762421591c1cde5/lib/crewai/tests/utilities/test_import_utils.py | lib/crewai/tests/utilities/test_import_utils.py | """Tests for import utilities."""
import sys
from unittest.mock import MagicMock, patch
import pytest
from crewai.utilities.import_utils import (
OptionalDependencyError,
import_and_validate_definition,
require,
validate_import_path,
)
class TestRequire:
"""Test the require function."""
def... | python | MIT | f3c17a249b5a2da3a917784d9762421591c1cde5 | 2026-01-04T14:39:52.484392Z | false |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI/blob/f3c17a249b5a2da3a917784d9762421591c1cde5/lib/crewai/tests/utilities/test_i18n.py | lib/crewai/tests/utilities/test_i18n.py | import pytest
from crewai.utilities.i18n import I18N
def test_load_prompts():
i18n = I18N()
i18n.load_prompts()
assert i18n._prompts is not None
def test_slice():
i18n = I18N()
i18n.load_prompts()
assert isinstance(i18n.slice("role_playing"), str)
def test_tools():
i18n = I18N()
i1... | python | MIT | f3c17a249b5a2da3a917784d9762421591c1cde5 | 2026-01-04T14:39:52.484392Z | false |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI/blob/f3c17a249b5a2da3a917784d9762421591c1cde5/lib/crewai/tests/utilities/test_string_utils.py | lib/crewai/tests/utilities/test_string_utils.py | from typing import Any, Dict, List, Union
import pytest
from crewai.utilities.string_utils import interpolate_only
class TestInterpolateOnly:
"""Tests for the interpolate_only function in string_utils.py."""
def test_basic_variable_interpolation(self):
"""Test basic variable interpolation works corr... | python | MIT | f3c17a249b5a2da3a917784d9762421591c1cde5 | 2026-01-04T14:39:52.484392Z | false |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI/blob/f3c17a249b5a2da3a917784d9762421591c1cde5/lib/crewai/tests/utilities/test_planning_handler.py | lib/crewai/tests/utilities/test_planning_handler.py | """Tests for the planning handler module."""
from unittest.mock import MagicMock, patch
import pytest
from crewai.agent import Agent
from crewai.crew import Crew
from crewai.knowledge.source.string_knowledge_source import StringKnowledgeSource
from crewai.task import Task
from crewai.tasks.task_output import TaskOut... | python | MIT | f3c17a249b5a2da3a917784d9762421591c1cde5 | 2026-01-04T14:39:52.484392Z | false |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI/blob/f3c17a249b5a2da3a917784d9762421591c1cde5/lib/crewai/tests/utilities/test_console_formatter_pause_resume.py | lib/crewai/tests/utilities/test_console_formatter_pause_resume.py | from unittest.mock import MagicMock, patch
from rich.live import Live
from crewai.events.utils.console_formatter import ConsoleFormatter
class TestConsoleFormatterPauseResume:
"""Test ConsoleFormatter pause/resume functionality for HITL features."""
def test_pause_stops_active_streaming_session(self):
... | python | MIT | f3c17a249b5a2da3a917784d9762421591c1cde5 | 2026-01-04T14:39:52.484392Z | false |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI/blob/f3c17a249b5a2da3a917784d9762421591c1cde5/lib/crewai/tests/utilities/test_knowledge_planning.py | lib/crewai/tests/utilities/test_knowledge_planning.py | """
Tests for verifying the integration of knowledge sources in the planning process.
This module ensures that agent knowledge is properly included during task planning.
"""
from unittest.mock import patch
import pytest
from crewai.agent import Agent
from crewai.knowledge.source.string_knowledge_source import StringK... | python | MIT | f3c17a249b5a2da3a917784d9762421591c1cde5 | 2026-01-04T14:39:52.484392Z | false |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI/blob/f3c17a249b5a2da3a917784d9762421591c1cde5/lib/crewai/tests/utilities/test_converter.py | lib/crewai/tests/utilities/test_converter.py | # Tests for enums
from enum import Enum
import json
import os
from unittest.mock import MagicMock, Mock, patch
from crewai.llm import LLM
from crewai.utilities.converter import (
Converter,
ConverterError,
convert_to_model,
convert_with_instructions,
create_converter,
generate_model_description... | python | MIT | f3c17a249b5a2da3a917784d9762421591c1cde5 | 2026-01-04T14:39:52.484392Z | false |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI/blob/f3c17a249b5a2da3a917784d9762421591c1cde5/lib/crewai/tests/utilities/test_file_handler.py | lib/crewai/tests/utilities/test_file_handler.py | import os
import unittest
import uuid
import pytest
from crewai.utilities.file_handler import PickleHandler
class TestPickleHandler(unittest.TestCase):
def setUp(self):
# Use a unique file name for each test to avoid race conditions in parallel test execution
unique_id = str(uuid.uuid4())
... | python | MIT | f3c17a249b5a2da3a917784d9762421591c1cde5 | 2026-01-04T14:39:52.484392Z | false |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI/blob/f3c17a249b5a2da3a917784d9762421591c1cde5/lib/crewai/tests/utilities/__init__.py | lib/crewai/tests/utilities/__init__.py | """Tests for utilities."""
| python | MIT | f3c17a249b5a2da3a917784d9762421591c1cde5 | 2026-01-04T14:39:52.484392Z | false |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI/blob/f3c17a249b5a2da3a917784d9762421591c1cde5/lib/crewai/tests/utilities/test_training_handler.py | lib/crewai/tests/utilities/test_training_handler.py | import os
import tempfile
import unittest
from crewai.utilities.training_handler import CrewTrainingHandler
class InternalCrewTrainingHandler(unittest.TestCase):
def setUp(self):
self.temp_file = tempfile.NamedTemporaryFile(suffix=".pkl", delete=False)
self.temp_file.close()
self.handler ... | python | MIT | f3c17a249b5a2da3a917784d9762421591c1cde5 | 2026-01-04T14:39:52.484392Z | false |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI/blob/f3c17a249b5a2da3a917784d9762421591c1cde5/lib/crewai/tests/utilities/test_training_converter.py | lib/crewai/tests/utilities/test_training_converter.py | from typing import List
from unittest.mock import MagicMock, patch
from crewai.utilities.converter import ConverterError
from crewai.utilities.training_converter import TrainingConverter
from pydantic import BaseModel, Field
class TestModel(BaseModel):
string_field: str = Field(description="A simple string field... | python | MIT | f3c17a249b5a2da3a917784d9762421591c1cde5 | 2026-01-04T14:39:52.484392Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.