Skip to content

Commit 196cc69

Browse files
committed
test for OSError in SoftFileLock
1 parent 68edf85 commit 196cc69

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

tests/test_filelock.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -504,3 +504,11 @@ def test_flock_not_implemented_unix(tmp_path: Path, mocker: MockerFixture) -> No
504504
with pytest.raises(NotImplementedError):
505505
with FileLock(str(tmp_path / "a.lock")):
506506
pass
507+
508+
509+
def test_soft_errors(tmp_path: Path, mocker: MockerFixture) -> None:
510+
mocker.patch("os.open", side_effect=OSError(ENOSYS, "mock error"))
511+
lock_path = tmp_path / "a.lock"
512+
lock = SoftFileLock(str(lock_path))
513+
with pytest.raises(OSError):
514+
lock.acquire()

0 commit comments

Comments
 (0)