@@ -32,20 +32,22 @@ async def test_ensure_directory_absent(tmp_path: pathlib.Path):
32
32
await ensure_absent (path )
33
33
assert not await aiofiles .os .path .exists (path )
34
34
35
+
35
36
@pytest .mark .asyncio
36
37
async def test_ensure_file_absent_when_open_for_reading (tmp_path : pathlib .Path ):
37
38
path = tmp_path / "test_file"
38
39
async with aiofiles .open (path , "w" ) as test_file :
39
40
await test_file .write ("foobar" )
40
-
41
+
41
42
# Open the file for reading
42
43
async with aiofiles .open (path , "r" ):
43
44
pass # Simply open and close the file
44
45
45
46
# Ensure the file is removed
46
47
await ensure_absent (path )
47
48
assert not await aiofiles .os .path .exists (path )
48
-
49
+
50
+
49
51
@pytest .mark .asyncio
50
52
async def test_ensure_non_empty_directory_absent (tmp_path : pathlib .Path ):
51
53
# Create a directory
@@ -63,7 +65,8 @@ async def test_ensure_non_empty_directory_absent(tmp_path: pathlib.Path):
63
65
64
66
# The directory should still exist since it was not removed
65
67
assert await aiofiles .os .path .exists (path )
66
-
68
+
69
+
67
70
@pytest .mark .asyncio
68
71
async def test_ensure_invalid_path (tmp_path : pathlib .Path ):
69
72
# Create an invalid path (e.g., a socket or a broken symlink)
@@ -92,7 +95,8 @@ async def test_ensure_absent_called_on_symlink(tmp_path: pathlib.Path):
92
95
93
96
# Original file should still exist
94
97
assert await aiofiles .os .path .exists (path )
95
-
98
+
99
+
96
100
@pytest .mark .asyncio
97
101
async def test_ensure_absent_removes_nested_empty_directory (tmp_path : pathlib .Path ):
98
102
# Create a nested directory structure
@@ -105,4 +109,3 @@ async def test_ensure_absent_removes_nested_empty_directory(tmp_path: pathlib.Pa
105
109
106
110
# Ensure parent directory still exists
107
111
assert await aiofiles .os .path .exists (tmp_path / "dir1" )
108
-
0 commit comments