Skip to content
Merged
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
6 changes: 3 additions & 3 deletions tests/test_filelock.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import threading
from concurrent.futures import ThreadPoolExecutor
from contextlib import contextmanager
from errno import ENOSYS
from errno import EAGAIN, ENOSYS, EWOULDBLOCK
from inspect import getframeinfo, stack
from pathlib import Path, PurePath
from stat import S_IWGRP, S_IWOTH, S_IWUSR, filemode
Expand Down Expand Up @@ -994,10 +994,10 @@ def test_lock_acquired_after_release_keeps_path(tmp_path: Path) -> None:
assert lock_path.exists()


@pytest.mark.skipif(sys.platform == "win32", reason="Unix flock semantics")
def test_waiter_fd_cannot_split_lock_after_release(tmp_path: Path) -> None:
if sys.platform == "win32": # pragma: win32 cover # Unix flock semantics; also narrows fcntl for the type checker
return
import fcntl
from errno import EAGAIN, EWOULDBLOCK

lock_path = tmp_path / "test.lock"
first = FileLock(str(lock_path), is_singleton=False)
Expand Down
4 changes: 1 addition & 3 deletions tests/test_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,10 @@ def test_break_lock_file_break_path_not_targetable_by_a_peer(tmp_path: Path, moc
# re-verify lstat and the unlink, and we would delete a live lock the inode check just approved.
predictable = tmp_path / f"test.lock.break.{os.getpid()}"
real_lstat = os.lstat
fired = {"x": False}

def lstat_hook(path: str) -> os.stat_result:
result = real_lstat(path)
if not fired["x"] and ".break." in path:
fired["x"] = True
if ".break." in path and not predictable.exists(): # once: the peer recreates a live lock at its own name
lock.write_text("live", encoding="utf-8")
lock.rename(predictable)
return result
Expand Down