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

Function test_nested_contruct

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

Source from the content-addressed store, hash-verified

203
204@pytest.mark.parametrize("lock_type", [FileLock, SoftFileLock])
205def test_nested_contruct(lock_type: type[BaseFileLock], tmp_path: Path) -> None:
206 # lock is re-entrant for a given file even if it is constructed multiple times
207 lock_path = tmp_path / "a"
208
209 with lock_type(str(lock_path), is_singleton=True, timeout=2) as lock_1:
210 assert lock_1.is_locked
211
212 with lock_type(str(lock_path), is_singleton=True, timeout=2) as lock_2:
213 assert lock_2 is lock_1
214 assert lock_2.is_locked
215
216 assert lock_1.is_locked
217
218 assert not lock_1.is_locked
219
220
221_ExcInfoType = Union[Tuple[Type[BaseException], BaseException, TracebackType], Tuple[None, None, None]]

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected