Skip to content

test: fix three pre-existing failures on Python 3.10 and fastmcp 3.4.3 - #518

Open
Sallvainian wants to merge 1 commit into
mbailey:masterfrom
Sallvainian:fix/python310-and-fastmcp-schema-tests
Open

test: fix three pre-existing failures on Python 3.10 and fastmcp 3.4.3#518
Sallvainian wants to merge 1 commit into
mbailey:masterfrom
Sallvainian:fix/python310-and-fastmcp-schema-tests

Conversation

@Sallvainian

Copy link
Copy Markdown
Contributor

Three tests fail on master today. The Test Voice Mode MCP workflow is
pull_request-triggered, so master never runs it — the breakage only shows up
on contributors' PRs, where it reads as "your branch broke CI".

Reproduced on a clean master checkout with no other changes present:

$ git checkout 5c1b3e4
$ uv run --python 3.10 -m pytest \
    tests/test_mcp_shutdown_patch.py::TestDispatchUntilClosed::test_cancels_on_iteration_error \
    tests/test_turns_discoverability.py

FAILED ...test_cancels_on_iteration_error - NameError: name 'ExceptionGroup' is not defined
FAILED ...test_turns_schema_property_carries_the_description - KeyError: 'description'
FAILED ...test_turns_schema_description_covers_key_contract_points - KeyError: 'description'
3 failed, 4 passed

ExceptionGroup on Python 3.10

ExceptionGroup only became a builtin in 3.11, so on 3.10 the name is undefined
and the assertion raises NameError instead of testing anything. exceptiongroup
is already locked as a dependency for python_full_version < '3.11' (uv.lock),
so this imports the backport there rather than adding anything new.

turns schema description on fastmcp 3.4.3

The tests read tool.parameters["properties"]["turns"]["description"]. fastmcp
3.4.3 emits an optional parameter as an anyOf union and carries the
description on a nested member, so the key is absent at the top level:

"turns": {"anyOf": [{"anyOf": [...], "description": "Ordered list of utterances..."}], "default": null}

The description is still present and still byte-for-byte correct — only its
position moved. Rather than hardcode the new shape (which just swaps one version
assumption for another), the lookup now walks anyOf members recursively, so it
passes on both the old and new layouts.

test_turns_param_description_constant_matches_readme_literal_text is untouched
and still enforces the golden README text, so the drift guard this file exists
for is unaffected.

Verification

before after
these two files, py3.10 3 failed, 4 passed 16 passed
these two files, py3.12 16 passed 16 passed
full suite, py3.10 3 failed 1918 passed, 56 skipped, 0 failed

Test-only; no runtime code touched, so no CHANGELOG entry.

Split out from #517 so the CI fix can land independently of that PR.

These fail on master today; the test workflow is pull_request-triggered, so
master never runs it and the breakage only surfaces on contributors' PRs.

test_mcp_shutdown_patch referenced ExceptionGroup, a 3.11+ builtin, so on 3.10
the name was undefined and the handler raised NameError instead of asserting
anything. The exceptiongroup backport is already locked for python < 3.11, so
import it there rather than leaving the name unbound.

test_turns_discoverability read the turns description at
parameters["properties"]["turns"]["description"]. fastmcp 3.4.3 emits an
optional parameter as an anyOf union and carries the description on a nested
member, so the key is absent at the top level and the assertion raised KeyError.
The description is still present and still correct -- only its position moved --
so resolve it recursively instead of pinning one nesting shape, which keeps the
test working across fastmcp versions rather than trading one version check for
another.

Verified: 3.10 and 3.12 both 16 passed for these two files (3.10 was 3 failed),
and the full suite on 3.10 is 1918 passed, 56 skipped, 0 failed.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant