Browse Source

Update tests to capture warnings

pull/14583/head
Sebastián Ramírez 7 months ago
parent
commit
eea02ddeea
  1. 9
      tests/test_tutorial/test_pydantic_v1_in_v2/test_tutorial002.py
  2. 9
      tests/test_tutorial/test_pydantic_v1_in_v2/test_tutorial003.py
  3. 9
      tests/test_tutorial/test_pydantic_v1_in_v2/test_tutorial004.py
  4. 9
      tests/test_tutorial/test_request_form_models/test_tutorial002_pv1.py

9
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

9
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

9
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

9
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

Loading…
Cancel
Save