Skip to content

Conversation

@constantinius
Copy link
Contributor

Issues

Closes https://linear.app/getsentry/issue/TET-1329/fastmcp-tests

Reminders

@linear
Copy link

linear bot commented Nov 6, 2025

TET-1329 FastMCP: tests

@codecov
Copy link

codecov bot commented Nov 6, 2025

❌ 7 Tests Failed:

Tests completed Failed Passed Skipped
27892 7 27885 2255
View the top 3 failed test(s) by shortest run time
tests.tracing.test_decorator::test_trace_decorator_no_trx
Stack Traces | 0.014s run time
tests/tracing/test_decorator.py:47: in test_trace_decorator_no_trx
    fake_debug.assert_called_once_with(
.../hostedtoolcache/Python/3.14.0.../x64/lib/python3.14/unittest/mock.py:996: in assert_called_once_with
    raise AssertionError(msg)
E   AssertionError: Expected 'mock' to be called once. Called 2 times.
E   Calls: [call('Cannot create a child span for %s. Please start a Sentry transaction before calling this function.', 'test_decorator.my_example_function'),
E    call('Cannot create a child span for %s. Please start a Sentry transaction before calling this function.', 'time.sleep')].
tests.integrations.fastmcp.test_fastmcp::test_fastmcp_mixed_sync_async_tools[fastmcp]
Stack Traces | 0.111s run time
.../integrations/fastmcp/test_fastmcp.py:1133: in test_fastmcp_mixed_sync_async_tools
    assert result1["result"] == 7
           ^^^^^^^^^^^^^^^^^
E   TypeError: 'int' object is not subscriptable
tests.integrations.fastmcp.test_fastmcp::test_fastmcp_tool_with_no_arguments[fastmcp]
Stack Traces | 0.112s run time
.../integrations/fastmcp/test_fastmcp.py:1054: in test_fastmcp_tool_with_no_arguments
    assert result["result"] == "success"
           ^^^^^^^^^^^^^^^^
E   TypeError: string indices must be integers, not 'str'
tests.integrations.fastmcp.test_fastmcp::test_fastmcp_multiple_tools[fastmcp]
Stack Traces | 0.128s run time
.../integrations/fastmcp/test_fastmcp.py:490: in test_fastmcp_multiple_tools
    result2 = call_tool_through_mcp(mcp, "tool_two", {"y": result1["result"]})
                                                           ^^^^^^^^^^^^^^^^^
E   TypeError: 'int' object is not subscriptable
tests.integrations.fastmcp.test_fastmcp::test_fastmcp_tool_with_no_arguments[fastmcp]
Stack Traces | 0.134s run time
.../integrations/fastmcp/test_fastmcp.py:1054: in test_fastmcp_tool_with_no_arguments
    assert result["result"] == "success"
           ^^^^^^^^^^^^^^^^
E   TypeError: string indices must be integers, not 'str'
tests.integrations.fastmcp.test_fastmcp::test_fastmcp_multiple_tools[fastmcp]
Stack Traces | 0.17s run time
.../integrations/fastmcp/test_fastmcp.py:490: in test_fastmcp_multiple_tools
    result2 = call_tool_through_mcp(mcp, "tool_two", {"y": result1["result"]})
                                                           ^^^^^^^^^^^^^^^^^
E   TypeError: 'int' object is not subscriptable
tests.integrations.fastmcp.test_fastmcp::test_fastmcp_mixed_sync_async_tools[fastmcp]
Stack Traces | 0.173s run time
.../integrations/fastmcp/test_fastmcp.py:1133: in test_fastmcp_mixed_sync_async_tools
    assert result1["result"] == 7
           ^^^^^^^^^^^^^^^^^
E   TypeError: 'int' object is not subscriptable

To view more test analytics, go to the Test Analytics Dashboard
📋 Got 3 mins? Take this short survey to help us improve Test Analytics.

@constantinius constantinius marked this pull request as ready for review November 6, 2025 10:11
@constantinius constantinius requested a review from a team as a code owner November 6, 2025 10:11
dramatiq: TESTPATH=tests/integrations/dramatiq
falcon: TESTPATH=tests/integrations/falcon
fastapi: TESTPATH=tests/integrations/fastapi
fastmcp: TESTPATH=tests/integrations/fastmcp
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: The fastmcp tox environment's TESTPATH in tox.ini line 808 points to a non-existent directory, preventing test discovery.
Severity: HIGH | Confidence: 1.00

🔍 Detailed Analysis

The fastmcp tox environment's TESTPATH is incorrectly configured in tox.ini at line 808. It points to tests/integrations/fastmcp, a non-existent directory. The actual test file, test_fastmcp.py, resides in tests/integrations/mcp. This misconfiguration prevents pytest from discovering and executing any tests for the fastmcp integration suite, resulting in a silent failure where no tests are run.

💡 Suggested Fix

Update tox.ini line 808 to set fastmcp: TESTPATH=tests/integrations/mcp. This will correctly direct pytest to the location of the fastmcp integration tests.

🤖 Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.

Location: tox.ini#L808

Potential issue: The `fastmcp` tox environment's `TESTPATH` is incorrectly configured in
`tox.ini` at line 808. It points to `tests/integrations/fastmcp`, a non-existent
directory. The actual test file, `test_fastmcp.py`, resides in `tests/integrations/mcp`.
This misconfiguration prevents `pytest` from discovering and executing any tests for the
`fastmcp` integration suite, resulting in a silent failure where no tests are run.

Did we get this right? 👍 / 👎 to inform future reviews.

Copy link
Contributor

@alexander-alderman-webb alexander-alderman-webb Nov 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would put the new tests in a new tests/integrations/fastmcp directory.

If we changed the TESTPATH of the fastmcp entry to be tests/integrations/mcp, then we would be running mcp tests twice in our CI.

@alexander-alderman-webb
Copy link
Contributor

alexander-alderman-webb commented Nov 7, 2025

There are CI failures due to version bumps picked up by generate_tox.py. We're fixing them

Comment on lines 243 to 247
if len(tool_spans) > 0:
span = tool_spans[0]
assert span["op"] == OP.MCP_SERVER
assert span["origin"] == "auto.ai.mcp"
assert span["data"][SPANDATA.MCP_METHOD_NAME] == "tools/call"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When running locally I see len(tool_spans) == 0. Do we expect spans here?

The same applies to other assertions in the the suite. I think it would be good to ensure the assertions run so that we can catch regressions.

"deps": {
"*": ["pytest-asyncio"],
},
},
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Python versioning breaks CI compatibility.

The fastmcp configuration is missing a Python version constraint. All fastmcp package versions require Python >=3.10 (visible in releases.jsonl), but the configuration doesn't specify "python": ">=3.10". This causes the GitHub Actions workflow to attempt running fastmcp tests on Python 3.8 and 3.9, which will fail since those tox environments don't exist (tox.ini only generates environments for Python 3.10+). The missing constraint also means tests might attempt to install incompatible package versions.

Fix in Cursor Fix in Web

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.

3 participants