| 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"): |