mirror of
https://github.com/lrnselfreliance/wrolpi.git
synced 2026-10-25 18:40:06 -04:00
Clear the FileWorker private queue between tests
The test harness resets the shared file worker public queue for each test, but the FileWorker's private LifoQueue is per-process state that survived from one test to the next. Tests that process only a count task leave its chained refresh task queued, and it later ran inside an unrelated test. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
d992dc99d2
commit
35b2a8fc84
1 changed files with 5 additions and 0 deletions
|
|
@ -50,6 +50,7 @@ from wrolpi.downloader import DownloadContext, DownloadManager, DownloadResult,
|
|||
downloads_manager_config_context, download_cache_config_context
|
||||
from wrolpi.errors import UnrecoverableDownloadError
|
||||
from wrolpi.files.models import Directory, FileGroup
|
||||
from wrolpi.files.worker import file_worker
|
||||
from wrolpi.switches import await_switches as await_switches_
|
||||
from wrolpi.tags import Tag, upsert_tag
|
||||
from wrolpi.vars import PROJECT_DIR
|
||||
|
|
@ -299,6 +300,10 @@ async def async_client(test_directory, test_session, clear_background_tasks) ->
|
|||
api_app.signalize()
|
||||
attach_shared_contexts(api_app)
|
||||
initialize_configs_contexts(api_app)
|
||||
# The FileWorker's private queue is per-process state that the shared-context reset does not touch;
|
||||
# each test starts with no FileTasks left over from a previous test.
|
||||
while not file_worker.private_queue.empty():
|
||||
file_worker.private_queue.get_nowait()
|
||||
|
||||
client = SanicASGITestClient(api_app)
|
||||
wrapped_client = AutoAwaitTestClient(client, test_session)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue