Skip to content

Test assertion fails on Chinese system locale #1472

@mingo1996

Description

@mingo1996

Initial Checks

Description

When running the test suite on a Chinese (Simplified, zh_CN) Windows system, one of the assertions failed due to language differences.

Environment

  • OS: Windows 11 (Simplified Chinese)
  • Python version: 3.11

Expected Behavior

The test should pass regardless of system language.

Actual Behavior

The test fails with an AssertionError:
Image

Suggestion

In Windows, it is modified to determine based on error codes.

assert (
    "nonexistent" in error_message
    or "not found" in error_message.lower()
    or "[winerror 2]" in error_message  # or "cannot find the file" in error_message.lower()  # Windows error message
)

Example Code

uv run pytest tests/client/test_stdio.py::test_stdio_client_nonexistent_command

Python & MCP Python SDK

Python version: 3.11
MCP Python SDK:latest

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3Nice to haves, rare edge casesPR welcomePRs for this issue are welcome and will be reviewed by maintainersbugSomething isn't workingready for workEnough information for someone to start working on

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions