test: add tests for server lifespan support

Adds comprehensive tests for lifespan functionality:
- Tests for both low-level Server and FastMCP classes
- Coverage for startup, shutdown, and context access
- Verifies context passing to request handlers
This commit is contained in:
David Soria Parra 2025-02-11 12:15:18 +00:00
commit e598750cba
No known key found for this signature in database

View file

@ -20,7 +20,10 @@ async def test_progress_token_zero_first_call():
mock_meta.progressToken = 0 # This is the key test case - token is 0
request_context = RequestContext(
request_id="test-request", session=mock_session, meta=mock_meta
request_id="test-request",
session=mock_session,
meta=mock_meta,
lifespan_context=None,
)
# Create context with our mocks