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

Function test_nested_acquire

tests/core/test_lock.py:200–217  ·  view source on GitHub ↗
(lock_type: type[BaseFileLock], tmp_path: Path)

Source from the content-addressed store, hash-verified

198
199@pytest.mark.parametrize("lock_type", [FileLock, SoftFileLock])
200def test_nested_acquire(lock_type: type[BaseFileLock], tmp_path: Path) -> None:
201 lock = lock_type(str(tmp_path / "a"))
202
203 with lock.acquire() as lock_1:
204 assert lock.is_locked
205 assert lock is lock_1
206
207 with lock.acquire() as lock_2:
208 assert lock.is_locked
209 assert lock is lock_2
210
211 with lock.acquire() as lock_3:
212 assert lock.is_locked
213 assert lock is lock_3
214
215 assert lock.is_locked
216 assert lock.is_locked
217 assert not lock.is_locked
218
219
220@pytest.mark.parametrize("lock_type", [FileLock, SoftFileLock])

Callers

nothing calls this directly

Calls 2

lock_typeFunction · 0.85
acquireMethod · 0.45

Tested by

no test coverage detected