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

Function execute

tests/sqlite/test_async_release_cancellation.py:190–198  ·  view source on GitHub ↗
(real_connection: sqlite3.Connection, statement: str)

Source from the content-addressed store, hash-verified

188 seen_in_transaction: list[bool] = []
189
190 def execute(real_connection: sqlite3.Connection, statement: str) -> sqlite3.Cursor:
191 nonlocal busy_once
192 if statement == "BEGIN TRANSACTION":
193 seen_in_transaction.append(real_connection.in_transaction)
194 if "SELECT name" in statement and busy_once:
195 # A writer can take the lock between the deferred BEGIN and the SELECT that needs the shared lock.
196 busy_once = False
197 raise _busy_error()
198 return real_connection.execute(statement)
199
200 patch_connection(mocker, execute=execute)
201 # With other threads alive the acquire waits in short slices that never reach the in-place retry under test.

Callers

nothing calls this directly

Calls 1

_busy_errorFunction · 0.85

Tested by

no test coverage detected