From 3723cd726e8d7730f32878e15ef54144c8a0dc19 Mon Sep 17 00:00:00 2001 From: chengyongru <2755839590@qq.com> Date: Mon, 6 Apr 2026 15:41:21 +0800 Subject: [PATCH] fix(msteams): remove optional deps from dev extras and gate tests PyJWT and cryptography are optional msteams deps; they should not be bundled into the generic dev install. Tests now skip the entire file when the deps are missing, following the dingtalk pattern. --- pyproject.toml | 2 -- tests/test_msteams.py | 13 ++++++++++++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index b5095ff01..e9aa6198d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -85,8 +85,6 @@ dev = [ "aiohttp>=3.9.0,<4.0.0", "pytest-cov>=6.0.0,<7.0.0", "ruff>=0.1.0", - "PyJWT>=2.0,<3.0", - "cryptography>=41.0", ] [project.scripts] diff --git a/tests/test_msteams.py b/tests/test_msteams.py index a253558e3..c75b51f94 100644 --- a/tests/test_msteams.py +++ b/tests/test_msteams.py @@ -1,7 +1,18 @@ import json -import jwt import pytest + +# Check optional msteams dependencies before running tests +try: + from nanobot.channels import msteams + MSTEAMS_AVAILABLE = getattr(msteams, "MSTEAMS_AVAILABLE", False) +except ImportError: + MSTEAMS_AVAILABLE = False + +if not MSTEAMS_AVAILABLE: + pytest.skip("MSTeams dependencies not installed (PyJWT, cryptography). Run: pip install nanobot-ai[msteams]", allow_module_level=True) + +import jwt from cryptography.hazmat.primitives.asymmetric import rsa import nanobot.channels.msteams as msteams_module