Skip to content

Commit 20fddae

Browse files
committed
Again
1 parent 5548742 commit 20fddae

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

tests/services/contents/test_fileio.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -125,16 +125,14 @@ def test_atomic_writing_newlines(tmp_path):
125125

126126

127127
async def test_watch_directory(tmp_path):
128-
stop_event = asyncio.Event()
129-
130128
async def change_dir():
129+
# let the watcher start
131130
await asyncio.sleep(0.1)
131+
# add file to directory
132132
(tmp_path / "file.txt").write_text("foo")
133-
await asyncio.sleep(0.1)
134-
stop_event.set()
135133

136134
asyncio.create_task(change_dir())
137-
138-
changes = [change async for change in awatch(tmp_path, stop_event=stop_event)]
139-
140-
assert changes == [{(Change.added, str(tmp_path / "file.txt"))}]
135+
stop_event = asyncio.Event()
136+
async for change in awatch(tmp_path, stop_event=stop_event):
137+
assert change == {(Change.added, str(tmp_path / "file.txt"))}
138+
stop_event.set()

0 commit comments

Comments
 (0)