Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Pre-commit Checks

on:
push:
branches: [ main, master, develop ] # 根据您的分支名调整
pull_request:
branches: [ main, master, develop ]

jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.x' # 指定您的Python版本

- name: Install pre-commit
run: pip install pre-commit

- name: Run pre-commit on all files
run: pre-commit run --all-files
10 changes: 3 additions & 7 deletions tests/client/test_stdio.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import time

import anyio
import errno
import pytest

from mcp.client.session import ClientSession
Expand Down Expand Up @@ -94,13 +95,8 @@ async def test_stdio_client_nonexistent_command():
async with stdio_client(server_params) as (_, _):
pass

# The error should indicate the command was not found
error_message = str(exc_info.value)
assert (
"nonexistent" in error_message
or "not found" in error_message.lower()
or "cannot find the file" in error_message.lower() # Windows error message
)
# The error should indicate the command was not found (ENOENT: No such file or directory)
assert exc_info.value.errno == errno.ENOENT


@pytest.mark.anyio
Expand Down
Loading