Skip to content

Commit 21cd085

Browse files
committed
run tests with extra dependencies separately
1 parent 0c7395e commit 21cd085

File tree

5 files changed

+13
-5
lines changed

5 files changed

+13
-5
lines changed

.github/workflows/run_tests.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,10 @@ jobs:
8383
args: check --fix-only
8484
- name: Run tests with pytest
8585
run: uv run -p .venv pytest tests/
86+
- name: Install optional depencies
87+
run: uv sync -p .venv --extra mcp
88+
- name: Run extra tests
89+
run: uv run -p .venv pytest tests/ -m extra --extra
8690

8791
build_package:
8892
name: Build Package

pyproject.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ dev = [
6262
"build>=1.0.3",
6363
"litellm>=1.60.3; sys_platform == 'win32'",
6464
"litellm[proxy]>=1.60.3; sys_platform != 'win32'",
65-
"mcp>=1.5.0; python_version >= '3.10'",
6665
]
6766
mcp = ["mcp; python_version >= '3.10'"]
6867

tests/conftest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
from tests.test_utils.server import litellm_test_server, read_litellm_test_server_request_logs # noqa: F401
66

7-
SKIP_DEFAULT_FLAGS = ["reliability"]
7+
SKIP_DEFAULT_FLAGS = ["reliability", "extra"]
88

99

1010
@pytest.fixture(autouse=True)

tests/utils/test_mcp.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,19 @@
11
import asyncio
2+
import importlib
23

34
import pytest
4-
from mcp import ClientSession, StdioServerParameters
5-
from mcp.client.stdio import stdio_client
65

76
from dspy.utils.mcp import convert_mcp_tool
87

8+
if importlib.util.find_spec("mcp") is None:
9+
pytest.skip(reason="mcp is not installed", allow_module_level=True)
10+
911

1012
@pytest.mark.asyncio
13+
@pytest.mark.extra
1114
async def test_convert_mcp_tool():
15+
from mcp import ClientSession, StdioServerParameters
16+
from mcp.client.stdio import stdio_client
1217
server_params = StdioServerParameters(
1318
command="python",
1419
args=["tests/utils/resources/mcp_server.py"],

uv.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)