🔊 Add deprecation warnings when using pydantic.v1 (#14583)

This commit is contained in:
Sebastián Ramírez
2025-12-21 08:44:10 -08:00
committed by GitHub
parent 6513d4daa1
commit 6e42bcd8ce
20 changed files with 756 additions and 556 deletions

View File

@@ -1,4 +1,5 @@
import importlib
import warnings
import pytest
from fastapi.testclient import TestClient
@@ -15,7 +16,13 @@ from ...utils import needs_py310, needs_pydanticv1
],
)
def get_client(request: pytest.FixtureRequest):
mod = importlib.import_module(f"docs_src.schema_extra_example.{request.param}")
with warnings.catch_warnings(record=True):
warnings.filterwarnings(
"ignore",
message=r"pydantic\.v1 is deprecated and will soon stop being supported by FastAPI\..*",
category=DeprecationWarning,
)
mod = importlib.import_module(f"docs_src.schema_extra_example.{request.param}")
client = TestClient(mod.app)
return client