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

Function test_nested_context_manager

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

Source from the content-addressed store, hash-verified

144
145@pytest.mark.parametrize("lock_type", [FileLock, SoftFileLock])
146def 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])

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…