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

Function test_nested_context_manager

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

Source from the content-addressed store, hash-verified

177
178@pytest.mark.parametrize("lock_type", [FileLock, SoftFileLock])
179def test_nested_context_manager(lock_type: type[BaseFileLock], tmp_path: Path) -> None:
180 lock = lock_type(str(tmp_path / "a"))
181
182 with lock as lock_1:
183 assert lock.is_locked
184 assert lock is lock_1
185
186 with lock as lock_2:
187 assert lock.is_locked
188 assert lock is lock_2
189
190 with lock as lock_3:
191 assert lock.is_locked
192 assert lock is lock_3
193
194 assert lock.is_locked
195 assert lock.is_locked
196 assert not lock.is_locked
197
198
199@pytest.mark.parametrize("lock_type", [FileLock, SoftFileLock])

Callers

nothing calls this directly

Calls 1

lock_typeFunction · 0.85

Tested by

no test coverage detected