From d951890916db4aeab20754378810f309aa78c36c Mon Sep 17 00:00:00 2001 From: Rodrigo Brandao Date: Tue, 4 Aug 2026 10:24:13 -0700 Subject: [PATCH] Optional teams package unit test fix --- pytest.ini | 1 + tests/hosting_teams/test_teams_agent_extension.py | 13 ++++++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/pytest.ini b/pytest.ini index 479894a8a..f2a7ece8d 100644 --- a/pytest.ini +++ b/pytest.ini @@ -10,6 +10,7 @@ filterwarnings = ignore::DeprecationWarning:pkg_resources.* ignore::DeprecationWarning:setuptools.* ignore::PendingDeprecationWarning + ignore:The bot client is deprecated and will be removed in a future release\.:DeprecationWarning # pytest-asyncio warnings that are safe to ignore ignore:.*deprecated.*asyncio.*:DeprecationWarning:pytest_asyncio.* diff --git a/tests/hosting_teams/test_teams_agent_extension.py b/tests/hosting_teams/test_teams_agent_extension.py index f16b514dd..c677c68c1 100644 --- a/tests/hosting_teams/test_teams_agent_extension.py +++ b/tests/hosting_teams/test_teams_agent_extension.py @@ -5,21 +5,28 @@ import re import sys +from importlib.util import find_spec import pytest from unittest.mock import AsyncMock, MagicMock, patch is_supported_version = sys.version_info >= (3, 12) +is_teams_installed = ( + is_supported_version and find_spec("microsoft_agents.hosting.teams") is not None +) pytestmark = pytest.mark.skipif( - not is_supported_version, - reason="microsoft-agents-hosting-teams tests require Python 3.12+", + not is_teams_installed, + reason=( + "microsoft-agents-hosting-teams tests require Python 3.12+ and the " + "microsoft-agents-hosting-teams package" + ), ) from microsoft_agents.activity import Activity, ActivityTypes from microsoft_agents.hosting.core import TurnContext from microsoft_agents.hosting.core.app import AgentApplication, RouteRank -if is_supported_version: +if is_teams_installed: from microsoft_agents.activity.teams import ( MeetingParticipantsEventDetails, ReadReceiptInfo,