Format updates to instructions and test file
- Improve markdown formatting in instructions.md - Reorder imports in test_background_loader_session.py per PEP8
This commit is contained in:
@@ -121,10 +121,11 @@ For each task completed:
|
||||
|
||||
✅ **Task Completed Successfully**
|
||||
|
||||
### Issue Fixed: TypeError: 'async for' requires an object with __aiter__ method
|
||||
### Issue Fixed: TypeError: 'async for' requires an object with **aiter** method
|
||||
|
||||
**Problem:**
|
||||
The BackgroundLoaderService was crashing when trying to load series data with the error:
|
||||
|
||||
```
|
||||
TypeError: 'async for' requires an object with __aiter__ method, got _AsyncGeneratorContextManager
|
||||
```
|
||||
@@ -136,6 +137,7 @@ The code was incorrectly using `async for db in get_db_session():` to get a data
|
||||
|
||||
**Solution:**
|
||||
Changed the database session acquisition from:
|
||||
|
||||
```python
|
||||
async for db in get_db_session():
|
||||
# ... code ...
|
||||
@@ -143,16 +145,19 @@ async for db in get_db_session():
|
||||
```
|
||||
|
||||
To the correct pattern:
|
||||
|
||||
```python
|
||||
async with get_db_session() as db:
|
||||
# ... code ...
|
||||
```
|
||||
|
||||
**Files Modified:**
|
||||
|
||||
1. [src/server/services/background_loader_service.py](src/server/services/background_loader_service.py) - Fixed async context manager usage
|
||||
2. [tests/unit/test_background_loader_session.py](tests/unit/test_background_loader_session.py) - Created comprehensive unit tests
|
||||
|
||||
**Tests:**
|
||||
|
||||
- ✅ 5 new unit tests for background loader database session handling (all passing)
|
||||
- ✅ Tests verify proper async context manager usage
|
||||
- ✅ Tests verify error handling and progress tracking
|
||||
|
||||
Reference in New Issue
Block a user