Added vacuum to CLI and Python API

This commit is contained in:
Simon Willison 2019-01-24 19:39:04 -08:00
commit 231224ba1a
6 changed files with 40 additions and 0 deletions

View file

@ -21,3 +21,8 @@ def db_path(tmpdir):
def test_table_names(db_path):
result = CliRunner().invoke(cli.cli, ["table_names", db_path])
assert "Gosh\nGosh2" == result.output.strip()
def test_vacuum(db_path):
result = CliRunner().invoke(cli.cli, ["vacuum", db_path])
assert 0 == result.exit_code

View file

@ -176,3 +176,8 @@ def test_create_view(fresh_db):
fresh_db.create_view("bar", "select bar from data")
rows = fresh_db.conn.execute("select * from bar").fetchall()
assert [("bar",)] == rows
def test_vacuum(fresh_db):
fresh_db["data"].insert({"foo": "foo", "bar": "bar"})
fresh_db.vacuum()