From fd2b089264b110b390dba5e0fb8563af53c4b5f7 Mon Sep 17 00:00:00 2001 From: Davor Runje Date: Wed, 18 Dec 2024 13:09:05 +0100 Subject: [PATCH] fixes Signed-off-by: Davor Runje --- test/interop/crewai/test_crewai.py | 6 +++--- test/interop/test_helpers.py | 6 +++--- test/interop/test_interoperability.py | 5 ++++- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/test/interop/crewai/test_crewai.py b/test/interop/crewai/test_crewai.py index 1f0bae4bb1..1a2cbbd513 100644 --- a/test/interop/crewai/test_crewai.py +++ b/test/interop/crewai/test_crewai.py @@ -4,8 +4,8 @@ import os import sys -import unittest from tempfile import TemporaryDirectory +from unittest.mock import MagicMock import pytest from conftest import reason, skip_openai @@ -13,7 +13,7 @@ if sys.version_info >= (3, 10) and sys.version_info < (3, 13): from crewai_tools import FileReadTool else: - FileReadTool = unittest.mock.MagicMock() + FileReadTool = MagicMock() from autogen import AssistantAgent, UserProxyAgent from autogen.interop import Interoperable @@ -21,7 +21,7 @@ if sys.version_info >= (3, 10) and sys.version_info < (3, 13): from autogen.interop.crewai import CrewAIInteroperability else: - CrewAIInteroperability = unittest.mock.MagicMock() + CrewAIInteroperability = MagicMock() # skip if python version is not in [3.10, 3.11, 3.12] diff --git a/test/interop/test_helpers.py b/test/interop/test_helpers.py index 9355fa510d..f3a5ad09ef 100644 --- a/test/interop/test_helpers.py +++ b/test/interop/test_helpers.py @@ -35,7 +35,7 @@ def test_find_classes_implementing_protocol(self) -> None: assert CrewAIInteroperability in actual expected_count += 1 - if sys.version_info >= (3, 10): + if sys.version_info >= (3, 9): from autogen.interop.langchain import LangchainInteroperability assert LangchainInteroperability in actual @@ -47,7 +47,7 @@ def test_get_all_interoperability_classes(self) -> None: actual = get_all_interoperability_classes() - if sys.version_info < (3, 10): + if sys.version_info < (3, 9): assert actual == {} if sys.version_info >= (3, 10) and sys.version_info < (3, 13): @@ -56,7 +56,7 @@ def test_get_all_interoperability_classes(self) -> None: assert actual == {"crewai": CrewAIInteroperability, "langchain": LangchainInteroperability} - if sys.version_info >= (3, 13): + if (sys.version_info >= (3, 9) and sys.version_info < (3, 10)) and sys.version_info >= (3, 13): from autogen.interop.langchain import LangchainInteroperability assert actual == {"langchain": LangchainInteroperability} diff --git a/test/interop/test_interoperability.py b/test/interop/test_interoperability.py index e0f5d3f70a..dacdc16c87 100644 --- a/test/interop/test_interoperability.py +++ b/test/interop/test_interoperability.py @@ -16,9 +16,12 @@ class TestInteroperability: def test_supported_types(self) -> None: actual = Interoperability.supported_types() - if sys.version_info < (3, 10): + if sys.version_info < (3, 9): assert actual == [] + if sys.version_info >= (3, 9) and sys.version_info < (3, 10): + assert actual == ["langchain"] + if sys.version_info >= (3, 10) and sys.version_info < (3, 13): assert actual == ["crewai", "langchain"]