diff --git a/tests/crew_test.py b/tests/crew_test.py index f74d9f61d..c469174d6 100644 --- a/tests/crew_test.py +++ b/tests/crew_test.py @@ -2387,7 +2387,7 @@ def test_using_contextual_memory(): # Check if ChromaDB is available try: - import chromadb + import chromadb # noqa: F401 HAS_CHROMADB = True except ImportError: HAS_CHROMADB = False @@ -2425,7 +2425,7 @@ def test_using_contextual_memory_with_long_term_memory(): # Check if ChromaDB is available try: - import chromadb + import chromadb # noqa: F401 HAS_CHROMADB = True except ImportError: HAS_CHROMADB = False @@ -2464,7 +2464,7 @@ def test_warning_long_term_memory_without_entity_memory(): # Check if ChromaDB is available try: - import chromadb + import chromadb # noqa: F401 HAS_CHROMADB = True except ImportError: HAS_CHROMADB = False @@ -2511,7 +2511,7 @@ def test_long_term_memory_with_memory_flag(): # Check if ChromaDB is available try: - import chromadb + import chromadb # noqa: F401 HAS_CHROMADB = True except ImportError: HAS_CHROMADB = False @@ -2556,7 +2556,7 @@ def test_using_contextual_memory_with_short_term_memory(): # Check if ChromaDB is available try: - import chromadb + import chromadb # noqa: F401 HAS_CHROMADB = True except ImportError: HAS_CHROMADB = False @@ -2595,7 +2595,7 @@ def test_disabled_memory_using_contextual_memory(): # Check if ChromaDB is available try: - import chromadb + import chromadb # noqa: F401 HAS_CHROMADB = True except ImportError: HAS_CHROMADB = False diff --git a/tests/memory/external_memory_test.py b/tests/memory/external_memory_test.py index cf973b1a5..d9a967e78 100644 --- a/tests/memory/external_memory_test.py +++ b/tests/memory/external_memory_test.py @@ -170,7 +170,7 @@ def test_crew_external_memory_save_with_memory_flag( mem_method, crew_with_external_memory ): try: - import chromadb + import chromadb # noqa: F401 HAS_CHROMADB = True except ImportError: HAS_CHROMADB = False @@ -190,6 +190,15 @@ def test_crew_external_memory_save_with_memory_flag( def test_crew_external_memory_save_using_crew_without_memory_flag( mem_method, crew_with_external_memory_without_memory_flag ): + try: + import chromadb # noqa: F401 + HAS_CHROMADB = True + except ImportError: + HAS_CHROMADB = False + + if not HAS_CHROMADB: + pytest.skip("ChromaDB is required for this test") + with patch( f"crewai.memory.external.external_memory.ExternalMemory.{mem_method}" ) as mock_method: diff --git a/tests/memory/long_term_memory_test.py b/tests/memory/long_term_memory_test.py index ad576d45e..d10e832d0 100644 --- a/tests/memory/long_term_memory_test.py +++ b/tests/memory/long_term_memory_test.py @@ -8,7 +8,7 @@ from crewai.memory.long_term.long_term_memory_item import LongTermMemoryItem def long_term_memory(): """Fixture to create a LongTermMemory instance""" try: - import chromadb + import chromadb # noqa: F401 HAS_CHROMADB = True except ImportError: HAS_CHROMADB = False @@ -21,7 +21,7 @@ def long_term_memory(): def test_save_and_search(long_term_memory): try: - import chromadb + import chromadb # noqa: F401 HAS_CHROMADB = True except ImportError: HAS_CHROMADB = False diff --git a/tests/memory/short_term_memory_test.py b/tests/memory/short_term_memory_test.py index d017b2cea..afc3cfb5c 100644 --- a/tests/memory/short_term_memory_test.py +++ b/tests/memory/short_term_memory_test.py @@ -13,7 +13,7 @@ from crewai.task import Task def short_term_memory(): """Fixture to create a ShortTermMemory instance""" try: - import chromadb + import chromadb # noqa: F401 HAS_CHROMADB = True except ImportError: HAS_CHROMADB = False @@ -39,7 +39,7 @@ def short_term_memory(): def test_save_and_search(short_term_memory): try: - import chromadb + import chromadb # noqa: F401 HAS_CHROMADB = True except ImportError: HAS_CHROMADB = False