(lock_type: type[BaseFileLock], tmp_path: Path)
| 203 | |
| 204 | @pytest.mark.parametrize("lock_type", [FileLock, SoftFileLock]) |
| 205 | def 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]] |
nothing calls this directly
no outgoing calls
no test coverage detected