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

This commit is contained in:
Sebastián Ramírez authored and GitHub committed 2025-12-21 17:44:10 +01:00
1 parent 6513d4daa1
commit 6e42bcd8ce
20 files changed
+756 -556

No files matched your search

@@ -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