Skip to content

Commit 3874a05

Browse files
committed
Again
1 parent 5548742 commit 3874a05

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

tests/services/contents/test_fileio.py

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

126126

127127
async def test_watch_directory(tmp_path):
128-
stop_event = asyncio.Event()
128+
file_path = tmp_path / "file.txt"
129129

130130
async def change_dir():
131+
# let the watcher start
131132
await asyncio.sleep(0.1)
132-
(tmp_path / "file.txt").write_text("foo")
133-
await asyncio.sleep(0.1)
134-
stop_event.set()
133+
# add file to directory
134+
file_path.write_text("foo")
135135

136136
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"))}]
137+
stop_event = asyncio.Event()
138+
async for change in awatch(tmp_path, stop_event=stop_event):
139+
assert change == {(Change.added, str(file_path))}
140+
stop_event.set()

0 commit comments

Comments
 (0)