aboutsummaryrefslogtreecommitdiff
path: root/tests/test_init.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test_init.py')
-rw-r--r--tests/test_init.py30
1 files changed, 23 insertions, 7 deletions
diff --git a/tests/test_init.py b/tests/test_init.py
index cff42f9..8f2bbb7 100644
--- a/tests/test_init.py
+++ b/tests/test_init.py
@@ -56,7 +56,9 @@ def test_in_memory_sqlite_enforces_foreign_keys_without_wal(app: Flask) -> None:
with app.app_context():
with db.engine.connect() as connection:
assert connection.exec_driver_sql("PRAGMA foreign_keys").scalar() == 1
- assert connection.exec_driver_sql("PRAGMA journal_mode").scalar() == "memory"
+ assert (
+ connection.exec_driver_sql("PRAGMA journal_mode").scalar() == "memory"
+ )
def test_file_sqlite_enables_wal_and_foreign_keys(tmp_path: Path) -> None:
@@ -69,12 +71,16 @@ def test_file_sqlite_enables_wal_and_foreign_keys(tmp_path: Path) -> None:
try:
with db.engine.connect() as connection:
assert connection.exec_driver_sql("PRAGMA foreign_keys").scalar() == 1
- assert connection.exec_driver_sql("PRAGMA journal_mode").scalar() == "wal"
+ assert (
+ connection.exec_driver_sql("PRAGMA journal_mode").scalar() == "wal"
+ )
# Foreign-key enforcement must also apply to fresh pooled connections.
db.engine.dispose()
with db.engine.connect() as connection:
assert connection.exec_driver_sql("PRAGMA foreign_keys").scalar() == 1
- assert connection.exec_driver_sql("PRAGMA journal_mode").scalar() == "wal"
+ assert (
+ connection.exec_driver_sql("PRAGMA journal_mode").scalar() == "wal"
+ )
finally:
db.engine.dispose()
@@ -89,7 +95,9 @@ def test_sqlite_settings_apply_to_sqlite_binds(tmp_path: Path) -> None:
try:
with db.engines["archive"].connect() as connection:
assert connection.exec_driver_sql("PRAGMA foreign_keys").scalar() == 1
- assert connection.exec_driver_sql("PRAGMA journal_mode").scalar() == "wal"
+ assert (
+ connection.exec_driver_sql("PRAGMA journal_mode").scalar() == "wal"
+ )
finally:
db.engines["archive"].dispose()
db.engine.dispose()
@@ -161,9 +169,15 @@ def test_in_memory_sqlite_skips_file_only_pragmas(tmp_path: Path) -> None:
with app.app_context():
try:
with db.engine.connect() as connection:
- assert connection.exec_driver_sql("PRAGMA journal_mode").scalar() == "memory"
+ assert (
+ connection.exec_driver_sql("PRAGMA journal_mode").scalar()
+ == "memory"
+ )
assert connection.exec_driver_sql("PRAGMA cache_size").scalar() == -4096
- assert connection.exec_driver_sql("PRAGMA wal_autocheckpoint").scalar() == 1000
+ assert (
+ connection.exec_driver_sql("PRAGMA wal_autocheckpoint").scalar()
+ == 1000
+ )
finally:
db.engine.dispose()
@@ -178,7 +192,9 @@ def test_sqlite_pragma_settings_also_apply_to_binds(tmp_path: Path) -> None:
with app.app_context():
try:
with db.engines["archive"].connect() as connection:
- assert connection.exec_driver_sql("PRAGMA busy_timeout").scalar() == 1234
+ assert (
+ connection.exec_driver_sql("PRAGMA busy_timeout").scalar() == 1234
+ )
assert connection.exec_driver_sql("PRAGMA cache_size").scalar() == -2048
finally:
db.engines["archive"].dispose()