feat(test): 移除 FileWatcher 中的 force_polling 参数,并添加等待时间以确保 watcher 建立基线
This commit is contained in:
@@ -123,7 +123,7 @@ async def test_add_callback_while_watcher_running(tmp_path: Path):
|
||||
dirs.mkdir(exist_ok=True)
|
||||
file = (dirs / "a.toml").resolve()
|
||||
file.touch()
|
||||
watcher = FileWatcher(paths=[dirs], debounce_ms=200, force_polling=True)
|
||||
watcher = FileWatcher(paths=[dirs], debounce_ms=200)
|
||||
|
||||
calls = 0
|
||||
|
||||
@@ -135,6 +135,7 @@ async def test_add_callback_while_watcher_running(tmp_path: Path):
|
||||
uuid = watcher.subscribe(callback, paths=[file])
|
||||
await watcher.start()
|
||||
try:
|
||||
await asyncio.sleep(0.5) # 等待 watcher 建立 baseline
|
||||
with file.open("w") as f:
|
||||
f.write("change")
|
||||
await _wait_for(lambda: calls >= 1)
|
||||
|
||||
Reference in New Issue
Block a user