diff --git a/pytests/config_test/test_file_watcher.py b/pytests/config_test/test_file_watcher.py index 319a17b0..91dde1d2 100644 --- a/pytests/config_test/test_file_watcher.py +++ b/pytests/config_test/test_file_watcher.py @@ -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)