From 6d86d30157514fb2bb8ffccdc7ca855540da54f4 Mon Sep 17 00:00:00 2001 From: Yannik Tausch Date: Thu, 7 Mar 2024 10:41:06 +0100 Subject: [PATCH] fix tests, use Pydantic ConfigDict --- .github/workflows/test-model.yml | 2 +- .github/workflows/tests.yml | 2 +- conda_forge_tick/models/common.py | 10 +++------- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/.github/workflows/test-model.yml b/.github/workflows/test-model.yml index 0fc5ed768a..88a8b5e62f 100644 --- a/.github/workflows/test-model.yml +++ b/.github/workflows/test-model.yml @@ -56,4 +56,4 @@ jobs: pytest \ -v \ --durations 10 \ - tests/model + ../tests/model diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index e6bd02f380..7478472300 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -96,7 +96,7 @@ jobs: --cov-config=.coveragerc \ --cov-report term-missing \ --durations 10 \ - --ignore=tests/model + --ignore=tests/model \ tests env: MONGODB_CONNECTION_STRING: "mongodb://127.0.0.1:27017/?directConnection=true&serverSelectionTimeoutMS=2000" diff --git a/conda_forge_tick/models/common.py b/conda_forge_tick/models/common.py index 3ebec68534..7ae36a5d0c 100644 --- a/conda_forge_tick/models/common.py +++ b/conda_forge_tick/models/common.py @@ -1,22 +1,18 @@ import re from typing import Annotated, Any, Generic, Literal, Never, TypeVar -from pydantic import BaseModel, BeforeValidator, Field, UrlConstraints +from pydantic import BaseModel, BeforeValidator, ConfigDict, Field, UrlConstraints from pydantic_core import Url T = TypeVar("T") class StrictBaseModel(BaseModel): - class Config: - validate_assignment = True - extra = "forbid" + model_config = ConfigDict(validate_assignment=True, extra="forbid") class ValidatedBaseModel(BaseModel): - class Config: - validate_assignment = True - extra = "allow" + model_config = ConfigDict(validate_assignment=True, extra="allow") class Set(StrictBaseModel, Generic[T]):