From 9943311435c6d55da2c1f00e70133e9a6dc46672 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebasti=C3=A1n=20Ram=C3=ADrez?= Date: Sat, 20 Dec 2025 13:52:29 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A5=20Remove=20marker=20needs=5Fpydant?= =?UTF-8?q?ic=5Fv2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../test_request_params/test_path/test_required_str.py | 6 ------ .../test_header_param_models/test_tutorial002.py | 10 +++++----- .../test_query_param_models/test_tutorial002.py | 10 +++++----- .../test_tutorial015.py | 6 +++--- tests/test_tutorial/test_settings/test_tutorial001.py | 4 ++-- tests/utils.py | 3 +-- 6 files changed, 16 insertions(+), 23 deletions(-) diff --git a/tests/test_request_params/test_path/test_required_str.py b/tests/test_request_params/test_path/test_required_str.py index ecd4eb61c..b2d63667e 100644 --- a/tests/test_request_params/test_path/test_required_str.py +++ b/tests/test_request_params/test_path/test_required_str.py @@ -4,8 +4,6 @@ import pytest from fastapi import FastAPI, Path from fastapi.testclient import TestClient -from tests.utils import needs_pydanticv2 - app = FastAPI() @@ -45,14 +43,12 @@ def read_required_alias_and_validation_alias( "p_val_alias", "P Val Alias", id="required-validation-alias", - marks=needs_pydanticv2, ), pytest.param( "/required-alias-and-validation-alias/{p_val_alias}", "p_val_alias", "P Val Alias", id="required-alias-and-validation-alias", - marks=needs_pydanticv2, ), ], ) @@ -75,12 +71,10 @@ def test_schema(path: str, expected_name: str, expected_title: str): pytest.param( "/required-validation-alias", id="required-validation-alias", - marks=needs_pydanticv2, ), pytest.param( "/required-alias-and-validation-alias", id="required-alias-and-validation-alias", - marks=needs_pydanticv2, ), ], ) diff --git a/tests/test_tutorial/test_header_param_models/test_tutorial002.py b/tests/test_tutorial/test_header_param_models/test_tutorial002.py index 889c8c065..ed4743ebf 100644 --- a/tests/test_tutorial/test_header_param_models/test_tutorial002.py +++ b/tests/test_tutorial/test_header_param_models/test_tutorial002.py @@ -5,16 +5,16 @@ from dirty_equals import IsDict from fastapi.testclient import TestClient from inline_snapshot import snapshot -from tests.utils import needs_py310, needs_pydanticv2 +from tests.utils import needs_py310 @pytest.fixture( name="client", params=[ - pytest.param("tutorial002_py39", marks=needs_pydanticv2), - pytest.param("tutorial002_py310", marks=[needs_py310, needs_pydanticv2]), - pytest.param("tutorial002_an_py39", marks=needs_pydanticv2), - pytest.param("tutorial002_an_py310", marks=[needs_py310, needs_pydanticv2]), + pytest.param("tutorial002_py39"), + pytest.param("tutorial002_py310", marks=[needs_py310]), + pytest.param("tutorial002_an_py39"), + pytest.param("tutorial002_an_py310", marks=[needs_py310]), ], ) def get_client(request: pytest.FixtureRequest): diff --git a/tests/test_tutorial/test_query_param_models/test_tutorial002.py b/tests/test_tutorial/test_query_param_models/test_tutorial002.py index e8e043490..0e9c3351a 100644 --- a/tests/test_tutorial/test_query_param_models/test_tutorial002.py +++ b/tests/test_tutorial/test_query_param_models/test_tutorial002.py @@ -5,16 +5,16 @@ from dirty_equals import IsDict from fastapi.testclient import TestClient from inline_snapshot import snapshot -from tests.utils import needs_py310, needs_pydanticv2 +from tests.utils import needs_py310 @pytest.fixture( name="client", params=[ - pytest.param("tutorial002_py39", marks=needs_pydanticv2), - pytest.param("tutorial002_py310", marks=[needs_py310, needs_pydanticv2]), - pytest.param("tutorial002_an_py39", marks=needs_pydanticv2), - pytest.param("tutorial002_an_py310", marks=[needs_py310, needs_pydanticv2]), + pytest.param("tutorial002_py39"), + pytest.param("tutorial002_py310", marks=[needs_py310]), + pytest.param("tutorial002_an_py39"), + pytest.param("tutorial002_an_py310", marks=[needs_py310]), ], ) def get_client(request: pytest.FixtureRequest): diff --git a/tests/test_tutorial/test_query_params_str_validations/test_tutorial015.py b/tests/test_tutorial/test_query_params_str_validations/test_tutorial015.py index 50ebf711f..82bb606a9 100644 --- a/tests/test_tutorial/test_query_params_str_validations/test_tutorial015.py +++ b/tests/test_tutorial/test_query_params_str_validations/test_tutorial015.py @@ -5,14 +5,14 @@ from dirty_equals import IsStr from fastapi.testclient import TestClient from inline_snapshot import snapshot -from ...utils import needs_py310, needs_pydanticv2 +from ...utils import needs_py310 @pytest.fixture( name="client", params=[ - pytest.param("tutorial015_an_py39", marks=needs_pydanticv2), - pytest.param("tutorial015_an_py310", marks=(needs_py310, needs_pydanticv2)), + pytest.param("tutorial015_an_py39"), + pytest.param("tutorial015_an_py310", marks=[needs_py310]), ], ) def get_client(request: pytest.FixtureRequest): diff --git a/tests/test_tutorial/test_settings/test_tutorial001.py b/tests/test_tutorial/test_settings/test_tutorial001.py index 2c6dce261..6a0809698 100644 --- a/tests/test_tutorial/test_settings/test_tutorial001.py +++ b/tests/test_tutorial/test_settings/test_tutorial001.py @@ -4,13 +4,13 @@ import pytest from fastapi.testclient import TestClient from pytest import MonkeyPatch -from ...utils import needs_pydanticv1, needs_pydanticv2 +from ...utils import needs_pydanticv1 @pytest.fixture( name="app", params=[ - pytest.param("tutorial001_py39", marks=needs_pydanticv2), + pytest.param("tutorial001_py39"), pytest.param("tutorial001_pv1_py39", marks=needs_pydanticv1), ], ) diff --git a/tests/utils.py b/tests/utils.py index 086bafc25..b896d4527 100644 --- a/tests/utils.py +++ b/tests/utils.py @@ -1,7 +1,6 @@ import sys import pytest -from fastapi._compat import PYDANTIC_V2 needs_py39 = pytest.mark.skipif(sys.version_info < (3, 9), reason="requires python3.9+") needs_py310 = pytest.mark.skipif( @@ -10,7 +9,7 @@ needs_py310 = pytest.mark.skipif( needs_py_lt_314 = pytest.mark.skipif( sys.version_info >= (3, 14), reason="requires python3.13-" ) -needs_pydanticv2 = pytest.mark.skipif(not PYDANTIC_V2, reason="requires Pydantic v2") + needs_pydanticv1 = needs_py_lt_314