mirror of
https://github.com/willmiao/ComfyUI-Lora-Manager.git
synced 2026-09-21 11:11:26 -03:00
fix(tests): deflake recipe open stats tests by shrinking debounce in tests
The four tests that wait on the background debounced write race against SAVE_DELAY (1.0s): _wait_for_save polls 100 x 0.01s = 1.0s, exactly equal to the debounce, leaving zero slack. On a loaded CI runner the write lands after the poll gives up, failing intermittently with 'Recipe open stats file was never written' (5 of 62 backend runs since the tests landed). Shrink SAVE_DELAY to 0.05s in _prepare so the write lands ~20x inside the poll window. The debounce duration is not what these tests verify; production default stays 1.0s.
This commit is contained in:
@@ -24,6 +24,11 @@ def _prepare(tmp_path: Path, monkeypatch: pytest.MonkeyPatch):
|
|||||||
monkeypatch.setattr(
|
monkeypatch.setattr(
|
||||||
stats_module, "get_settings_dir", lambda create=True: str(settings_dir)
|
stats_module, "get_settings_dir", lambda create=True: str(settings_dir)
|
||||||
)
|
)
|
||||||
|
# Shrink the debounce well below the 100 x 0.01s poll window in
|
||||||
|
# _wait_for_save so the background write always lands with a wide margin.
|
||||||
|
# The debounce duration is not what these tests verify; SAVE_DELAY stays
|
||||||
|
# at its production default (1.0s) outside this test module.
|
||||||
|
monkeypatch.setattr(RecipeOpenStats, "SAVE_DELAY", 0.05)
|
||||||
created_tasks = []
|
created_tasks = []
|
||||||
real_create_task = stats_module.asyncio.create_task
|
real_create_task = stats_module.asyncio.create_task
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user