mirror of
https://github.com/fastapi/fastapi.git
synced 2026-05-03 21:23:53 -04:00
🔊 Add deprecation warnings when using pydantic.v1 (#14583)
This commit is contained in:
committed by
GitHub
parent
6513d4daa1
commit
6e42bcd8ce
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user