Skip to content

Commit

Permalink
Again
Browse files Browse the repository at this point in the history
  • Loading branch information
davidbrochart committed Apr 8, 2022
1 parent 5548742 commit 20fddae
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions tests/services/contents/test_fileio.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,16 +125,14 @@ def test_atomic_writing_newlines(tmp_path):


async def test_watch_directory(tmp_path):
stop_event = asyncio.Event()

async def change_dir():
# let the watcher start
await asyncio.sleep(0.1)
# add file to directory
(tmp_path / "file.txt").write_text("foo")
await asyncio.sleep(0.1)
stop_event.set()

asyncio.create_task(change_dir())

changes = [change async for change in awatch(tmp_path, stop_event=stop_event)]

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 comments on commit 20fddae

Please sign in to comment.