File tree 1 file changed +8
-8
lines changed
1 file changed +8
-8
lines changed Original file line number Diff line number Diff line change @@ -125,16 +125,16 @@ def test_atomic_writing_newlines(tmp_path):
125
125
126
126
127
127
async def test_watch_directory (tmp_path ):
128
- stop_event = asyncio . Event ()
128
+ file_path = tmp_path / "file.txt"
129
129
130
130
async def change_dir ():
131
+ # let the watcher start
131
132
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" )
135
135
136
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" ))}]
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 ()
You can’t perform that action at this time.
0 commit comments