(lock_type: type[BaseFileLock], tmp_path: Path)
| 144 | |
| 145 | @pytest.mark.parametrize("lock_type", [FileLock, SoftFileLock]) |
| 146 | def test_nested_context_manager(lock_type: type[BaseFileLock], tmp_path: Path) -> None: |
| 147 | # lock is not released before the most outer with statement that locked the lock, is left |
| 148 | lock_path = tmp_path / "a" |
| 149 | lock = lock_type(str(lock_path)) |
| 150 | |
| 151 | with lock as lock_1: |
| 152 | assert lock.is_locked |
| 153 | assert lock is lock_1 |
| 154 | |
| 155 | with lock as lock_2: |
| 156 | assert lock.is_locked |
| 157 | assert lock is lock_2 |
| 158 | |
| 159 | with lock as lock_3: |
| 160 | assert lock.is_locked |
| 161 | assert lock is lock_3 |
| 162 | |
| 163 | assert lock.is_locked |
| 164 | assert lock.is_locked |
| 165 | assert not lock.is_locked |
| 166 | |
| 167 | |
| 168 | @pytest.mark.parametrize("lock_type", [FileLock, SoftFileLock]) |
nothing calls this directly
no outgoing calls
no test coverage detected
searching dependent graphs…