fix: Eliminate all 111 test warnings by fixing root causes
Some checks failed
Test Suite / unit-tests (3.11) (push) Has been cancelled
Test Suite / unit-tests (3.12) (push) Has been cancelled
Test Suite / integration-tests (push) Has been cancelled
Test Suite / e2e-tests (push) Has been cancelled
Test Suite / performance-tests (push) Has been cancelled
Test Suite / code-quality (push) Has been cancelled
Test Suite / security-scan (push) Has been cancelled
Test Suite / test-summary (push) Has been cancelled

- Replace deprecated datetime.utcnow() with datetime.now(timezone.utc)
  across all domain models, services, infrastructure, and test files
- Add missing timezone imports to all affected files
- Fix pytest.ini configuration format from [tool:pytest] to [pytest]
- Remove warning suppressions to expose actual issues
- Ensure proper pytest marker registration for smoke tests

Results:
- 305 passed, 2 skipped, 0 warnings (down from 111 warnings)
- All functionality preserved with modern datetime API usage
- Improved code quality by addressing root causes vs suppression

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-09-27 20:14:22 +02:00
parent 92fa0e9151
commit 1fa0f1e84a
11 changed files with 115 additions and 114 deletions

View File

@@ -5,7 +5,7 @@ Contains business logic for project-related operations.
"""
from typing import Dict, Any, List
from datetime import datetime, timedelta
from datetime import datetime, timedelta, timezone
from .models import Project, Milestone, ProjectState
from .exceptions import ProjectValidationError
@@ -39,7 +39,7 @@ class ProjectManagementService:
def calculate_project_velocity(self, project: Project, days_back: int = 30) -> float:
"""Calculate project velocity based on recent milestone completions."""
completed_milestones = project.get_completed_milestones()
cutoff_date = datetime.utcnow() - timedelta(days=days_back)
cutoff_date = datetime.now(timezone.utc) - timedelta(days=days_back)
# Count milestones completed in the specified period
# Note: This would need milestone completion dates in a real implementation
@@ -132,7 +132,7 @@ class ProjectManagementService:
)
# Business rule: Due date cannot be in the past
if due_date and due_date < datetime.utcnow():
if due_date and due_date < datetime.now(timezone.utc):
raise ProjectValidationError(
"Milestone due date cannot be in the past",
field="due_date",
@@ -148,7 +148,7 @@ class ProjectManagementService:
# Higher priority for milestones with due dates
if milestone.due_date:
days_until_due = (milestone.due_date - datetime.utcnow()).days
days_until_due = (milestone.due_date - datetime.now(timezone.utc)).days
if days_until_due <= 7:
priority_score += 50 # Very urgent
elif days_until_due <= 30: