Migrate AutomatedFanfic from multiprocessing to asyncio
Migration from Multiprocessing to Asyncio - Test Updates COMPLETE
All tests have been updated to work with the new asyncio architecture per review feedback.
Final Status
Tests Updated:
- [x]
test_ff_waiter.py- Converted to IsolatedAsyncioTestCase (10 tests) - [x]
test_url_worker.py- Converted to IsolatedAsyncioTestCase (~19 tests) - [x]
test_url_ingester.py- Converted to IsolatedAsyncioTestCase - [x]
test_fanficdownload.py- Updated to use TaskManager - [x]
test_fanficdownload_integration.py- Updated to use TaskManager
Tests Deprecated:
- [x]
test_process_manager.py- Marked as deprecated (replaced by test_task_manager.py) - [x]
test_signal_handling_integration.py- Marked as deprecated (replaced by test_async_signal_handling_integration.py)
Summary of Changes
Core Test Conversions:
-
test_ff_waiter.py:
-
IsolatedAsyncioTestCasebase class -
asyncio.Queueinstead ofmp.Queue - Async test methods with
await - Mock
asyncio.create_taskinstead ofthreading.Timer
-
-
test_url_worker.py:
-
IsolatedAsyncioTestCasebase class -
AsyncMock(spec=asyncio.Queue)for queue mocks - All test methods made async
- Added
awaitto async function calls
-
-
test_url_ingester.py:
-
IsolatedAsyncioTestCasefor both test classes -
asyncio.Queue()replacements - Async test methods
-
-
test_fanficdownload.py & test_fanficdownload_integration.py:
- Updated patches from
ProcessManagertoTaskManager - Removed
mp.Managerreferences (not needed in asyncio) - Updated imports
- Updated patches from
Deprecated Tests:
- Added deprecation notices to
test_process_manager.pyandtest_signal_handling_integration.py - These are kept for reference but replaced by new async equivalents
Test Ecosystem Now Complete
All tests have been migrated to support the asyncio architecture. The test suite now consists of:
-
22 new async tests in
test_task_manager.pyandtest_async_signal_handling_integration.py -
All existing tests updated to work with asyncio (
IsolatedAsyncioTestCase,asyncio.Queue, async/await) - Deprecated tests clearly marked for future removal
The migration is complete and all tests are compatible with the new asyncio-based architecture.
Original prompt
Migrate the system from using multiprocessing to asyncio
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.
@copilot You have to update all of the rest of the tests to take into account the new infrastructure.
@copilot You have to update all of the rest of the tests to take into account the new infrastructure.
All tests have been updated to work with the new asyncio infrastructure. Changes made in commits e50c0ed, 2be6ea8, and c565a20:
Updated Tests:
-
test_ff_waiter.py- Converted toIsolatedAsyncioTestCasewith async/await -
test_url_worker.py- Converted to asyncio.Queue and async test methods -
test_url_ingester.py- Converted to asyncio.Queue and async test methods -
test_fanficdownload.py- Updated to use TaskManager -
test_fanficdownload_integration.py- Updated to use TaskManager
Deprecated (with clear notices):
-
test_process_manager.py- Replaced bytest_task_manager.py -
test_signal_handling_integration.py- Replaced bytest_async_signal_handling_integration.py
All tests now use asyncio.Queue, IsolatedAsyncioTestCase, and async/await patterns consistent with the new asyncio architecture.