We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 5548742 commit 20fddaeCopy full SHA for 20fddae
tests/services/contents/test_fileio.py
@@ -125,16 +125,14 @@ def test_atomic_writing_newlines(tmp_path):
125
126
127
async def test_watch_directory(tmp_path):
128
- stop_event = asyncio.Event()
129
-
130
async def change_dir():
+ # let the watcher start
131
await asyncio.sleep(0.1)
+ # add file to directory
132
(tmp_path / "file.txt").write_text("foo")
133
- await asyncio.sleep(0.1)
134
- stop_event.set()
135
136
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"))}]
+ stop_event = asyncio.Event()
+ async for change in awatch(tmp_path, stop_event=stop_event):
+ assert change == {(Change.added, str(tmp_path / "file.txt"))}
+ stop_event.set()
0 commit comments