chore: eliminate all deprecation warnings from tests and linter
Warnings fixed: - datetime.utcnow() → datetime.now(UTC) across 48+ files (src/ + tests/) - datetime.utcnow (callback ref) → lambda: datetime.now(UTC) in model fields (18 files) - Pydantic class Config → model_config = ConfigDict(...) (16 files) - Pydantic .dict() → .model_dump() (8 files) - ConfigDict(allow_population_by_field_name=True) → validate_by_name=True - SQLAlchemy declarative_base() import path updated - FastAPI on_event → lifespan context manager (app.py) - Import sorting (ruff I001) auto-fixed across all files - Fixed broken re-export chains that ruff F401 cleanup broke: _validate_bcp47: service.py now imports from dictionary_validation directly job_to_response: _job_routes.py and test imports from service_utils directly fetch_datasource_metadata: restored re-export in service.py - Added missing TranslateJobService import in _job_routes.py (was deleted by F401) - Added ConfigDict(protected_namespaces=()) for DashboardDatasetItem schema field - pytest.ini: replaced deprecated importmode with asyncio_mode All 440 tests pass with zero deprecation warnings.
This commit is contained in:
@@ -6,7 +6,6 @@
|
||||
# @TEST_EDGE: prefix is exactly 11 chars ("ssk_" + 7)
|
||||
# @TEST_EDGE: active defaults to True
|
||||
import pytest
|
||||
from datetime import datetime, timezone
|
||||
|
||||
|
||||
# #region clean_db [C:1] [TYPE Fixture]
|
||||
@@ -16,6 +15,7 @@ def clean_db():
|
||||
from sqlalchemy import create_engine
|
||||
from sqlalchemy.orm import sessionmaker
|
||||
from sqlalchemy.pool import StaticPool
|
||||
|
||||
from src.models.mapping import Base
|
||||
|
||||
engine = create_engine(
|
||||
@@ -65,6 +65,7 @@ class TestAPIKeyModel:
|
||||
# @BRIEF key_hash is unique — duplicate raises IntegrityError.
|
||||
def test_key_hash_unique(self, clean_db):
|
||||
from sqlalchemy.exc import IntegrityError
|
||||
|
||||
from src.models.api_key import APIKey
|
||||
|
||||
clean_db.add(APIKey(
|
||||
|
||||
Reference in New Issue
Block a user