From d55f92d6a9b820c4c768ede3aafba15391c6387d Mon Sep 17 00:00:00 2001 From: Leandro Lucarella Date: Wed, 25 Sep 2024 11:45:38 +0200 Subject: [PATCH] Don't watch the whole directory in the file watcher test When watching the whole test directory we'll also get some events for the directory, and those events can come with different order depending on the OS, so we can't rely on them. Instead, we should watch a specific file, so we can control the order of the events. Signed-off-by: Leandro Lucarella --- tests/test_file_watcher_integration.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_file_watcher_integration.py b/tests/test_file_watcher_integration.py index 85c7f655..a79ee41b 100644 --- a/tests/test_file_watcher_integration.py +++ b/tests/test_file_watcher_integration.py @@ -26,7 +26,7 @@ async def test_file_watcher(tmp_path: pathlib.Path) -> None: number_of_writes = 0 expected_number_of_writes = 3 - file_watcher = FileWatcher(paths=[str(tmp_path)]) + file_watcher = FileWatcher(paths=[str(filename)]) timer = Timer(timedelta(seconds=0.1), SkipMissedAndDrift()) async for selected in select(file_watcher, timer):