File tree Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -258,14 +258,24 @@ def test_cleanup_queue_tracking_empty():
258
258
@pytest .mark .asyncio
259
259
async def test_get_next_dlset_empty_database (bootstrap ):
260
260
''' test get_next_dlset with empty database '''
261
+ import contextlib
262
+ import sqlite3
263
+
261
264
config = bootstrap
262
265
dbdir = config .testdir .joinpath ('imagecache' )
263
266
dbdir .mkdir ()
264
267
265
268
imagecache = nowplaying .imagecache .ImageCache (cachedir = dbdir )
266
- result = imagecache .get_next_dlset ()
267
-
268
- assert result is None or result == []
269
+ try :
270
+ result = imagecache .get_next_dlset ()
271
+ assert result is None or result == []
272
+ finally :
273
+ # Clean up SQLite WAL files to prevent flaky test failures
274
+ if imagecache .databasefile .exists ():
275
+ with contextlib .suppress (Exception ):
276
+ with sqlite3 .connect (imagecache .databasefile , timeout = 5 ) as conn :
277
+ conn .execute ("PRAGMA wal_checkpoint(TRUNCATE)" )
278
+ conn .execute ("PRAGMA journal_mode=DELETE" )
269
279
270
280
271
281
@pytest .mark .asyncio
You can’t perform that action at this time.
0 commit comments