Skip to content

Commit b9f991f

Browse files
committed
set the busy_timeout pragma
1 parent ae646e4 commit b9f991f

File tree

6 files changed

+477
-4
lines changed

6 files changed

+477
-4
lines changed

litequery/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
from litequery.core import setup
22

3-
__version__ = "0.5.3"
3+
__version__ = "0.5.4"
44
__all__ = ["setup"]

litequery/core.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ class LitequeryBase:
9494
("mmap_size", 134217728), # 128 Mb
9595
("journal_size_limit", 67108864), # 64 Mb
9696
("cache_size", 2000),
97+
("busy_timeout", 5000),
9798
]
9899

99100
def __init__(self, database, queries):

mise.toml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
[env]
2+
_.file = ".env"
3+
_.python.venv = {path = ".venv", create = true}
4+
5+
[tools]
6+
python = "3.11"
7+
uv = "latest"

pyproject.toml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
44

55
[project]
66
name = "litequery"
7-
version = "0.5.3"
7+
version = "0.5.4"
88
authors = [{ name = "Dima Charnyshou", email = "[email protected]" }]
99
description = "A handy way to interact with an SQLite database from Python"
1010
readme = "README.md"
@@ -14,6 +14,11 @@ classifiers = [
1414
"License :: OSI Approved :: MIT License",
1515
"Operating System :: OS Independent",
1616
]
17+
dependencies = [
18+
"aiosqlite",
19+
"pytest",
20+
"pytest-asyncio",
21+
]
1722

1823
[project.urls]
1924
Homepage = "https://github.com/imryche/litequery"
@@ -29,3 +34,8 @@ extend-ignore = ["UP007"]
2934

3035
[tool.ruff.lint]
3136
extend-select = ["I", "UP", "E501", "ASYNC"]
37+
38+
[dependency-groups]
39+
dev = [
40+
"ipdb>=0.13.13",
41+
]

tests/test_core.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import os
22
import sqlite3
3+
from dataclasses import fields
34
from datetime import datetime
45

56
import pytest
@@ -233,12 +234,13 @@ async def test_pragmas_configured_async(lq_async):
233234
("mmap_size", 134217728), # 128 Mb
234235
("journal_size_limit", 67108864), # 64 Mb
235236
("cache_size", 2000),
237+
("busy_timeout", 5000),
236238
]
237239
conn = await lq_async.get_connection()
238240
for pragma, expected_value in expected_pragmas:
239241
async with conn.execute(f"pragma {pragma}") as cursor:
240242
result = await cursor.fetchone()
241-
assert getattr(result, pragma) == expected_value
243+
assert getattr(result, fields(result)[0].name, None) == expected_value
242244

243245

244246
def test_pragmas_configured_sync(lq_sync):
@@ -249,8 +251,9 @@ def test_pragmas_configured_sync(lq_sync):
249251
("mmap_size", 134217728), # 128 Mb
250252
("journal_size_limit", 67108864), # 64 Mb
251253
("cache_size", 2000),
254+
("busy_timeout", 5000),
252255
]
253256
conn = lq_sync.get_connection()
254257
for pragma, expected_value in expected_pragmas:
255258
result = conn.execute(f"pragma {pragma}").fetchone()
256-
assert getattr(result, pragma) == expected_value
259+
assert getattr(result, fields(result)[0].name, None) == expected_value

0 commit comments

Comments
 (0)