From 7e2ab0d71d73d4c2fadf2e72b792796cafe86682 Mon Sep 17 00:00:00 2001 From: DrSmoothl <1787882683@qq.com> Date: Mon, 9 Mar 2026 14:57:59 +0800 Subject: [PATCH] =?UTF-8?q?feat(test):=20=E7=A7=BB=E9=99=A4=20FileWatcher?= =?UTF-8?q?=20=E4=B8=AD=E7=9A=84=20force=5Fpolling=20=E5=8F=82=E6=95=B0?= =?UTF-8?q?=EF=BC=8C=E5=B9=B6=E6=B7=BB=E5=8A=A0=E7=AD=89=E5=BE=85=E6=97=B6?= =?UTF-8?q?=E9=97=B4=E4=BB=A5=E7=A1=AE=E4=BF=9D=20watcher=20=E5=BB=BA?= =?UTF-8?q?=E7=AB=8B=E5=9F=BA=E7=BA=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pytests/config_test/test_file_watcher.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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)