Skip to content

Commit 305a5b3

Browse files
AMDmi3pohmelie
andauthored
pathio: update expected exceptions list from unlink on directory (fixes #117) (#118)
* tests: Fix expected exceptions from unlink call on directory (#118) POSIX prescribes ([1]) unlink(2) to return EPERM when called on directories: [EPERM] The file named by path is a directory, and either the calling process does not have appropriate privileges, or the implementation prohibits using unlink() on directories. and returning EISDIR in this case is Linux-specific behavior which does not happen on e.g. FreeBSD. So expect either of IsADirectoryError, PermissionError in the corresponding test. [1] https://pubs.opengroup.org/onlinepubs/007904975/toc.htm * Update history.rst Co-authored-by: Nikita Melentev <multisosnooley@gmail.com>
1 parent e564745 commit 305a5b3

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

history.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
x.x.x (xx-xx-xxxx)
22
------------------
33

4+
- tests: fix test_unlink_on_dir on POSIX compatible systems (#118)
5+
Thanks to `AMDmi3 <https://github.com/AMDmi3>`_
6+
47
0.16.1 (09-07-2020)
58
------------------
69

tests/test_pathio.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ async def test_unlink_not_exist(path_io, temp_dir):
252252

253253
@pytest.mark.asyncio
254254
async def test_unlink_on_dir(path_io, temp_dir):
255-
with universal_exception_reason(IsADirectoryError):
255+
with universal_exception_reason(IsADirectoryError, PermissionError):
256256
await path_io.unlink(temp_dir)
257257

258258

0 commit comments

Comments
 (0)