Skip to content

Commit a8295c5

Browse files
ericapisaniclaude
andcommitted
test(fastapi): Skip body content test on Starlette < 0.21
FastAPI 0.79.1 pulls in Starlette 0.19.1, whose `TestClient` is built on `requests` and does not accept the `content` kwarg. Match the skipif already in place for the analogous Starlette test so CI on older FastAPI versions passes. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 793e2f7 commit a8295c5

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

tests/integrations/fastapi/test_fastapi.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
from unittest import mock
77

88
import fastapi
9+
import starlette
910
from fastapi import FastAPI, HTTPException, Request
1011
from fastapi.testclient import TestClient
1112
from fastapi.middleware.trustedhost import TrustedHostMiddleware
@@ -20,6 +21,7 @@
2021

2122

2223
FASTAPI_VERSION = parse_version(fastapi.__version__)
24+
STARLETTE_VERSION = parse_version(starlette.__version__)
2325

2426
from tests.integrations.conftest import parametrize_test_configurable_status_codes
2527
from tests.integrations.starlette import test_starlette
@@ -299,6 +301,10 @@ async def _read_json(request):
299301
assert "hello" in attr
300302

301303

304+
@pytest.mark.skipif(
305+
STARLETTE_VERSION < (0, 21),
306+
reason="Requires Starlette >= 0.21, because earlier versions use a requests-based TestClient which does not support the 'content' kwarg",
307+
)
302308
@pytest.mark.parametrize("middleware_spans", [False, True])
303309
def test_request_body_data_annotated_value_top_level_span_streaming(
304310
sentry_init, capture_items, middleware_spans

0 commit comments

Comments
 (0)