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:
@@ -5,7 +5,7 @@
|
||||
# @LAYER Tests
|
||||
# @TEST_DATA: valid_task -> {"id": "test-uuid-1", "plugin_id": "backup", "status": "PENDING"}
|
||||
|
||||
from datetime import datetime
|
||||
from datetime import UTC, datetime
|
||||
from unittest.mock import patch
|
||||
|
||||
from sqlalchemy import create_engine
|
||||
@@ -17,7 +17,6 @@ from src.models.mapping import Base, Environment
|
||||
from src.models.task import TaskRecord
|
||||
|
||||
|
||||
|
||||
# #region TestTaskPersistenceHelpers [C:2] [TYPE Class]
|
||||
# @RELATION BINDS_TO -> test_task_persistence
|
||||
# @PURPOSE: Test suite for TaskPersistenceService static helper methods.
|
||||
@@ -194,7 +193,7 @@ class TestTaskPersistenceService:
|
||||
|
||||
# Update status
|
||||
task.status = TaskStatus.RUNNING
|
||||
task.started_at = datetime.utcnow()
|
||||
task.started_at = datetime.now(UTC)
|
||||
|
||||
with self._patched():
|
||||
self.service.persist_task(task)
|
||||
@@ -283,8 +282,8 @@ class TestTaskPersistenceService:
|
||||
"""Test loading tasks from database (round-trip)."""
|
||||
task = self._make_task(
|
||||
status=TaskStatus.SUCCESS,
|
||||
started_at=datetime.utcnow(),
|
||||
finished_at=datetime.utcnow(),
|
||||
started_at=datetime.now(UTC),
|
||||
finished_at=datetime.now(UTC),
|
||||
)
|
||||
task.params = {"key": "value"}
|
||||
task.result = {"output": "done"}
|
||||
|
||||
Reference in New Issue
Block a user