From 61a0978d996b80a2a24b64e1b27c9a5d07f72217 Mon Sep 17 00:00:00 2001 From: Savva Surenkov Date: Sat, 30 Mar 2024 18:53:39 +0400 Subject: [PATCH] Separate some of the schemas to make sure tests are run --- tests/v1/schema.py | 26 ++++++++++++++++++++++++++ tests/v1/test_base.py | 2 +- tests/v1/test_forms.py | 2 +- tests/v1/test_rest_framework.py | 2 +- 4 files changed, 29 insertions(+), 3 deletions(-) create mode 100644 tests/v1/schema.py diff --git a/tests/v1/schema.py b/tests/v1/schema.py new file mode 100644 index 0000000..c984e8a --- /dev/null +++ b/tests/v1/schema.py @@ -0,0 +1,26 @@ +import typing as t +from datetime import date + +try: + import pydantic.v1 as pydantic +except ImportError: + import pydantic + +from pydantic.dataclasses import dataclass + + +class InnerSchema(pydantic.BaseModel): + stub_str: str + stub_int: int = 1 + stub_list: t.List[date] + + class Config: + allow_mutation = True + frozen = False + + +@dataclass +class SampleDataclass: + stub_str: str + stub_list: t.List[date] + stub_int: int = 1 diff --git a/tests/v1/test_base.py b/tests/v1/test_base.py index 601253a..686c9f9 100644 --- a/tests/v1/test_base.py +++ b/tests/v1/test_base.py @@ -10,7 +10,7 @@ import pytest -from tests.conftest import InnerSchema, SampleDataclass +from .schema import InnerSchema, SampleDataclass base = pytest.importorskip("django_pydantic_field.v1.base") diff --git a/tests/v1/test_forms.py b/tests/v1/test_forms.py index a816d25..36e4c34 100644 --- a/tests/v1/test_forms.py +++ b/tests/v1/test_forms.py @@ -5,7 +5,7 @@ from django.core.exceptions import ValidationError from django.forms import Form, modelform_factory -from tests.conftest import InnerSchema +from .schema import InnerSchema from tests.test_app.models import SampleForwardRefModel, SampleSchema fields = pytest.importorskip("django_pydantic_field.v1.fields") diff --git a/tests/v1/test_rest_framework.py b/tests/v1/test_rest_framework.py index f23bbdf..06333bf 100644 --- a/tests/v1/test_rest_framework.py +++ b/tests/v1/test_rest_framework.py @@ -9,7 +9,7 @@ from rest_framework.decorators import api_view, parser_classes, renderer_classes, schema from rest_framework.response import Response -from tests.conftest import InnerSchema +from .schema import InnerSchema from tests.test_app.models import SampleModel rest_framework = pytest.importorskip("django_pydantic_field.v1.rest_framework")