fix: eliminate all test suite warnings - Issue #129
Comprehensive fix for test suite warnings across multiple issue test files: ### SQLite3 Date Adapter Warnings (Python 3.12) - Fixed 101 warnings in Issue 113 (activity_tracker.py) - Fixed 55 warnings in Issue 114 (allocation_engine.py) - Fixed 148 warnings in Issue 122 (worktime_tracker.py + test file) - Fixed 18 warnings in Issue 124 (day_wrapup_commands.py + worktime_tracker.py) ### Pytest-asyncio Configuration - Added asyncio_default_fixture_loop_scope = function to pytest.ini - Eliminates pytest-asyncio deprecation warning ### Runtime Warnings for Unawaited Coroutines - Fixed 2 warnings in Issue 59 (gitea plugin async mocking) - Enhanced AsyncTestCase with better coroutine cleanup - Improved async mock management in test utilities ### Technical Changes - Convert Python date/datetime objects to ISO strings before SQLite queries - Use .isoformat() with defensive hasattr() checks for backward compatibility - Simplified async test mocking to avoid coroutine creation - Enhanced cleanup_async_mocks() function for comprehensive cleanup ### Results - Before: ~324 warnings across test suite - After: 0 warnings - completely clean test suite - All 216+ tests pass with zero warning noise 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -149,7 +149,7 @@ class IssueActivityTracker:
|
||||
SELECT id FROM cost_periods
|
||||
WHERE ? BETWEEN period_start AND period_end
|
||||
ORDER BY created_at DESC LIMIT 1
|
||||
''', (activity_date,))
|
||||
''', (activity_date.isoformat(),))
|
||||
result = cursor.fetchone()
|
||||
if result:
|
||||
period_id = result[0]
|
||||
@@ -158,7 +158,7 @@ class IssueActivityTracker:
|
||||
INSERT INTO issue_activity_log
|
||||
(issue_id, activity_type, activity_date, period_id, activity_details)
|
||||
VALUES (?, ?, ?, ?, ?)
|
||||
''', (issue_id, activity_type.value, activity_date, period_id, activity_details))
|
||||
''', (issue_id, activity_type.value, activity_date.isoformat(), period_id, activity_details))
|
||||
|
||||
return cursor.lastrowid
|
||||
|
||||
@@ -294,11 +294,11 @@ class IssueActivityTracker:
|
||||
|
||||
if start_date:
|
||||
base_conditions.append('activity_date >= ?')
|
||||
params.append(start_date)
|
||||
params.append(start_date.isoformat() if hasattr(start_date, 'isoformat') else start_date)
|
||||
|
||||
if end_date:
|
||||
base_conditions.append('activity_date <= ?')
|
||||
params.append(end_date)
|
||||
params.append(end_date.isoformat() if hasattr(end_date, 'isoformat') else end_date)
|
||||
|
||||
where_clause = ' AND '.join(base_conditions) if base_conditions else '1=1'
|
||||
|
||||
@@ -401,7 +401,7 @@ class IssueActivityTracker:
|
||||
SELECT id FROM cost_periods
|
||||
WHERE ? BETWEEN period_start AND period_end
|
||||
ORDER BY created_at DESC LIMIT 1
|
||||
''', (activity_date,))
|
||||
''', (activity_date.isoformat() if hasattr(activity_date, 'isoformat') else activity_date,))
|
||||
result = cursor.fetchone()
|
||||
if result:
|
||||
period_id = result[0]
|
||||
@@ -410,7 +410,7 @@ class IssueActivityTracker:
|
||||
INSERT INTO issue_activity_log
|
||||
(issue_id, activity_type, activity_date, period_id, activity_details)
|
||||
VALUES (?, ?, ?, ?, ?)
|
||||
''', (issue_id, activity_type.value, activity_date, period_id, activity_details))
|
||||
''', (issue_id, activity_type.value, activity_date.isoformat() if hasattr(activity_date, 'isoformat') else activity_date, period_id, activity_details))
|
||||
|
||||
activity_ids.append(cursor.lastrowid)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user