test: improve deterministic unit test coverage
This commit is contained in:
@@ -1,10 +1,11 @@
|
||||
"""Test session management with cache-friendly message handling."""
|
||||
|
||||
import asyncio
|
||||
from pathlib import Path
|
||||
from unittest.mock import AsyncMock, MagicMock
|
||||
|
||||
import pytest
|
||||
from pathlib import Path
|
||||
|
||||
from nanobot.session.manager import Session, SessionManager
|
||||
|
||||
# Test constants
|
||||
@@ -603,9 +604,10 @@ class TestNewCommandArchival:
|
||||
loop.sessions.save(session)
|
||||
|
||||
archived = asyncio.Event()
|
||||
release_archive = asyncio.Event()
|
||||
|
||||
async def _slow_summarize(_messages) -> bool:
|
||||
await asyncio.sleep(0.1)
|
||||
await release_archive.wait()
|
||||
archived.set()
|
||||
return True
|
||||
|
||||
@@ -615,5 +617,6 @@ class TestNewCommandArchival:
|
||||
await loop._process_message(new_msg)
|
||||
|
||||
assert not archived.is_set()
|
||||
release_archive.set()
|
||||
await loop.close_mcp()
|
||||
assert archived.is_set()
|
||||
|
||||
Reference in New Issue
Block a user