Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/changelog/732.packaging.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Check symlink refusal by error code instead of error message so the test suite also passes with musl's wording.
3 changes: 2 additions & 1 deletion tests/test_filelock.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from __future__ import annotations

import errno
import inspect
import logging
import os
Expand Down Expand Up @@ -2042,7 +2043,7 @@ def test_final_symlink_backend_refuses_to_lock(tmp_path: Path) -> None:
(tmp_path / "link").symlink_to(tmp_path / "target")
# Keeping the final symlink a distinct key is safe because the backend still refuses to lock through it. O_NOFOLLOW
# reports the refusal as ELOOP on Linux and macOS, and as EFTYPE ("inappropriate file type") on NetBSD.
with pytest.raises(OSError, match=r"Too many levels of symbolic links|symbolic link|Inappropriate file type"):
with pytest.raises(OSError, check=lambda exc: exc.errno in {errno.ELOOP, getattr(errno, "EFTYPE", errno.ELOOP)}):
FileLock(str(tmp_path / "link")).acquire()


Expand Down