diff --git a/tests/test_tutorial/test_pydantic_v1_in_v2/test_tutorial002.py b/tests/test_tutorial/test_pydantic_v1_in_v2/test_tutorial002.py index 266d25944..ab7e1d8a7 100644 --- a/tests/test_tutorial/test_pydantic_v1_in_v2/test_tutorial002.py +++ b/tests/test_tutorial/test_pydantic_v1_in_v2/test_tutorial002.py @@ -1,4 +1,5 @@ import sys +import warnings import pytest from inline_snapshot import snapshot @@ -24,7 +25,13 @@ from ...utils import needs_py310 ], ) def get_client(request: pytest.FixtureRequest): - mod = importlib.import_module(f"docs_src.pydantic_v1_in_v2.{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.pydantic_v1_in_v2.{request.param}") c = TestClient(mod.app) return c diff --git a/tests/test_tutorial/test_pydantic_v1_in_v2/test_tutorial003.py b/tests/test_tutorial/test_pydantic_v1_in_v2/test_tutorial003.py index 693c3ba29..c45e04248 100644 --- a/tests/test_tutorial/test_pydantic_v1_in_v2/test_tutorial003.py +++ b/tests/test_tutorial/test_pydantic_v1_in_v2/test_tutorial003.py @@ -1,4 +1,5 @@ import sys +import warnings import pytest from inline_snapshot import snapshot @@ -24,7 +25,13 @@ from ...utils import needs_py310 ], ) def get_client(request: pytest.FixtureRequest): - mod = importlib.import_module(f"docs_src.pydantic_v1_in_v2.{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.pydantic_v1_in_v2.{request.param}") c = TestClient(mod.app) return c diff --git a/tests/test_tutorial/test_pydantic_v1_in_v2/test_tutorial004.py b/tests/test_tutorial/test_pydantic_v1_in_v2/test_tutorial004.py index 0fd084c84..f3da849e0 100644 --- a/tests/test_tutorial/test_pydantic_v1_in_v2/test_tutorial004.py +++ b/tests/test_tutorial/test_pydantic_v1_in_v2/test_tutorial004.py @@ -1,4 +1,5 @@ import sys +import warnings import pytest from inline_snapshot import snapshot @@ -24,7 +25,13 @@ from ...utils import needs_py310 ], ) def get_client(request: pytest.FixtureRequest): - mod = importlib.import_module(f"docs_src.pydantic_v1_in_v2.{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.pydantic_v1_in_v2.{request.param}") c = TestClient(mod.app) return c diff --git a/tests/test_tutorial/test_request_form_models/test_tutorial002_pv1.py b/tests/test_tutorial/test_request_form_models/test_tutorial002_pv1.py index 9ab30086b..515a5a8d7 100644 --- a/tests/test_tutorial/test_request_form_models/test_tutorial002_pv1.py +++ b/tests/test_tutorial/test_request_form_models/test_tutorial002_pv1.py @@ -1,4 +1,5 @@ import importlib +import warnings import pytest from fastapi.testclient import TestClient @@ -14,7 +15,13 @@ from ...utils import needs_pydanticv1 ], ) def get_client(request: pytest.FixtureRequest): - mod = importlib.import_module(f"docs_src.request_form_models.{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.request_form_models.{request.param}") client = TestClient(mod.app) return client