MCPcopy Create free account
hub / github.com/tox-dev/filelock / test_timeout

Function test_timeout

tests/core/test_timeout.py:28–43  ·  view source on GitHub ↗
(lock_type: type[BaseFileLock], tmp_path: Path)

Source from the content-addressed store, hash-verified

26
27@pytest.mark.parametrize("lock_type", [FileLock, SoftFileLock])
28def test_timeout(lock_type: type[BaseFileLock], tmp_path: Path) -> None:
29 lock_path = tmp_path / "a"
30 lock_1, lock_2 = lock_type(str(lock_path)), lock_type(str(lock_path))
31
32 lock_1.acquire()
33 assert lock_1.is_locked
34 assert not lock_2.is_locked
35
36 with pytest.raises(Timeout, match=r"The file lock '.*' could not be acquired."):
37 lock_2.acquire(timeout=0.1)
38 assert not lock_2.is_locked
39 assert lock_1.is_locked
40
41 lock_1.release()
42 assert not lock_1.is_locked
43 assert not lock_2.is_locked
44
45
46@pytest.mark.parametrize("lock_type", [FileLock, SoftFileLock])

Callers

nothing calls this directly

Calls 3

lock_typeFunction · 0.85
acquireMethod · 0.45
releaseMethod · 0.45

Tested by

no test coverage detected