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

Function test_operational_error_handling

tests/test_read_write_unit.py:523–536  ·  view source on GitHub ↗
(
    lock_file: str,
    mocker: MockerFixture,
    error_msg: str,
    expected_exception: type[Exception],
    mode: Literal["read", "write"],
)

Source from the content-addressed store, hash-verified

521 ],
522)
523def test_operational_error_handling(
524 lock_file: str,
525 mocker: MockerFixture,
526 error_msg: str,
527 expected_exception: type[Exception],
528 mode: Literal["read", "write"],
529) -> None:
530 lock = ReadWriteLock(lock_file, is_singleton=False)
531 con_mock = mocker.MagicMock()
532 con_mock.execute.side_effect = sqlite3.OperationalError(error_msg)
533 lock._con = con_mock
534 acquire = lock.acquire_read if mode == "read" else lock.acquire_write
535 with pytest.raises(expected_exception):
536 acquire()
537
538
539def test_write_lock_context_manager_overrides_defaults(lock_file: str) -> None:

Callers

nothing calls this directly

Calls 1

ReadWriteLockClass · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…