mirror of
https://github.com/simonw/datasette.git
synced 2026-06-06 17:16:57 +02:00
Refactor hidden_table_names() to use new implemenatation
Refs https://github.com/simonw/datasette/pull/2749#issuecomment-4565727978
This commit is contained in:
parent
bcd989f4f8
commit
aaf00e9ec2
4 changed files with 43 additions and 87 deletions
|
|
@ -8,7 +8,7 @@ from datasette.app import Datasette
|
|||
from datasette.database import Database, Results, MultipleValues
|
||||
from datasette.database import DatasetteClosedError
|
||||
from datasette.database import _deliver_write_result
|
||||
from datasette.utils.sqlite import sqlite3, sqlite_version
|
||||
from datasette.utils.sqlite import sqlite3
|
||||
from datasette.utils import Column
|
||||
import pytest
|
||||
import time
|
||||
|
|
@ -798,14 +798,7 @@ async def test_in_memory_databases_forbid_writes(app_client):
|
|||
assert await db.table_names() == ["foo"]
|
||||
|
||||
|
||||
def pragma_table_list_supported():
|
||||
return sqlite_version()[1] >= 37
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.skipif(
|
||||
not pragma_table_list_supported(), reason="Requires PRAGMA table_list support"
|
||||
)
|
||||
async def test_hidden_tables(app_client):
|
||||
ds = app_client.ds
|
||||
db = ds.add_database(Database(ds, is_memory=True, is_mutable=True))
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ Tests for various datasette helper functions.
|
|||
from datasette.app import Datasette
|
||||
from datasette import utils
|
||||
from datasette.utils.asgi import Request
|
||||
from datasette.utils.sqlite import sqlite3, sqlite_table_type
|
||||
from datasette.utils.sqlite import sqlite3, sqlite_hidden_table_names, sqlite_table_type
|
||||
import json
|
||||
import os
|
||||
import pathlib
|
||||
|
|
@ -246,6 +246,16 @@ def test_sqlite_table_type_detects_virtual_and_shadow_tables(monkeypatch, use_fa
|
|||
assert sqlite_table_type(conn, "boxes") == "virtual"
|
||||
assert sqlite_table_type(conn, "boxes_node") == "shadow"
|
||||
assert sqlite_table_type(conn, "missing") is None
|
||||
assert sqlite_hidden_table_names(conn) == [
|
||||
"boxes_node",
|
||||
"boxes_parent",
|
||||
"boxes_rowid",
|
||||
"search_index_config",
|
||||
"search_index_content",
|
||||
"search_index_data",
|
||||
"search_index_docsize",
|
||||
"search_index_idx",
|
||||
]
|
||||
finally:
|
||||
conn.close()
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue