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

Function switch_before_begin

tests/sqlite/test_connection.py:234–238  ·  view source on GitHub ↗
(connection: ForkSafeConnection, statement: str)

Source from the content-addressed store, hash-verified

232 execute = ForkSafeConnection.execute
233
234 def switch_before_begin(connection: ForkSafeConnection, statement: str) -> sqlite3.Cursor:
235 if statement.startswith("BEGIN"):
236 with closing(sqlite3.connect(lock_file)) as peer:
237 peer.executescript("PRAGMA journal_mode=WAL; PRAGMA user_version=1;")
238 return execute(connection, statement)
239
240 mocker.patch.object(ForkSafeConnection, "execute", new=switch_before_begin)
241 with pytest.raises(ValueError, match="switched to WAL mode while acquiring"):

Callers

nothing calls this directly

Calls 1

executeFunction · 0.70

Tested by

no test coverage detected