mirror of
https://github.com/simonw/sqlite-utils.git
synced 2026-07-23 01:14:31 +02:00
Additional tests for WAL mode
This should have been included in 2d2d724e32
Refs #132
This commit is contained in:
parent
de10590344
commit
c449064297
1 changed files with 24 additions and 0 deletions
24
tests/test_wal.py
Normal file
24
tests/test_wal.py
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
import pytest
|
||||
from sqlite_utils import Database
|
||||
import sqlite3
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def db_path_tmpdir(tmpdir):
|
||||
path = tmpdir / "test.db"
|
||||
db = Database(str(path))
|
||||
return db, path, tmpdir
|
||||
|
||||
|
||||
def test_enable_disable_wal(db_path_tmpdir):
|
||||
db, path, tmpdir = db_path_tmpdir
|
||||
assert len(tmpdir.listdir()) == 1
|
||||
assert "delete" == db.journal_mode
|
||||
assert "test.db-wal" not in [f.basename for f in tmpdir.listdir()]
|
||||
db.enable_wal()
|
||||
assert "wal" == db.journal_mode
|
||||
db["test"].insert({"foo": "bar"})
|
||||
assert "test.db-wal" in [f.basename for f in tmpdir.listdir()]
|
||||
db.disable_wal()
|
||||
assert "delete" == db.journal_mode
|
||||
assert "test.db-wal" not in [f.basename for f in tmpdir.listdir()]
|
||||
Loading…
Add table
Add a link
Reference in a new issue