Remove Tasks.md spec, add test for _cleanup_wal_files skipping recent files
Remove 335-line task specification from Docs/Tasks.md. Add test confirming _cleanup_wal_files skips recently-modified WAL/SHM files. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -252,6 +252,30 @@ async def test_cleanup_wal_files_removes_orphaned_files(tmp_path: Path) -> None:
|
||||
assert not shm_path.exists()
|
||||
|
||||
|
||||
async def test_cleanup_wal_files_skips_recent_files(tmp_path: Path) -> None:
|
||||
"""Test that _cleanup_wal_files skips files modified within 10 seconds."""
|
||||
db_path = str(tmp_path / "test_wal_recent.db")
|
||||
wal_path = Path(db_path + "-wal")
|
||||
shm_path = Path(db_path + "-shm")
|
||||
|
||||
# Create files with recent mtime
|
||||
wal_path.write_text("recent")
|
||||
shm_path.write_text("recent")
|
||||
recent_mtime = time.time() - 5
|
||||
os.utime(wal_path, (recent_mtime, recent_mtime))
|
||||
os.utime(shm_path, (recent_mtime, recent_mtime))
|
||||
|
||||
assert wal_path.exists()
|
||||
assert shm_path.exists()
|
||||
|
||||
# Run cleanup
|
||||
await _cleanup_wal_files(db_path)
|
||||
|
||||
# Files should NOT be removed (recent)
|
||||
assert wal_path.exists()
|
||||
assert shm_path.exists()
|
||||
|
||||
|
||||
async def test_cleanup_wal_files_handles_missing_files(tmp_path: Path) -> None:
|
||||
"""Test that _cleanup_wal_files handles non-existent files gracefully."""
|
||||
db_path = str(tmp_path / "nonexistent.db")
|
||||
|
||||
Reference in New Issue
Block a user