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

Function test_nested_acquire

tests/test_filelock.py:165–184  ·  view source on GitHub ↗
(lock_type: type[BaseFileLock], tmp_path: Path)

Source from the content-addressed store, hash-verified

163
164@pytest.mark.parametrize("lock_type", [FileLock, SoftFileLock])
165def test_nested_acquire(lock_type: type[BaseFileLock], tmp_path: Path) -> None:
166 # lock is not released before the most outer with statement that locked the lock, is left
167 lock_path = tmp_path / "a"
168 lock = lock_type(str(lock_path))
169
170 with lock.acquire() as lock_1:
171 assert lock.is_locked
172 assert lock is lock_1
173
174 with lock.acquire() as lock_2:
175 assert lock.is_locked
176 assert lock is lock_2
177
178 with lock.acquire() as lock_3:
179 assert lock.is_locked
180 assert lock is lock_3
181
182 assert lock.is_locked
183 assert lock.is_locked
184 assert not lock.is_locked
185
186
187@pytest.mark.parametrize("lock_type", [FileLock, SoftFileLock])

Callers

nothing calls this directly

Calls 1

acquireMethod · 0.45

Tested by

no test coverage detected