Skip SpatiaLite test if no conn.enable_load_extension()

Ran into this problem while working on #1802
pull/1803/head
Simon Willison 2022-09-05 17:05:23 -07:00
rodzic b91e17280c
commit b2b901e8c4
2 zmienionych plików z 10 dodań i 0 usunięć

Wyświetl plik

@ -1,5 +1,6 @@
from datasette.app import Datasette
from datasette.utils import find_spatialite, SpatialiteNotFound, SPATIALITE_FUNCTIONS
from .utils import has_load_extension
import pytest
@ -13,6 +14,7 @@ def has_spatialite():
@pytest.mark.asyncio
@pytest.mark.skipif(not has_spatialite(), reason="Requires SpatiaLite")
@pytest.mark.skipif(not has_load_extension(), reason="Requires enable_load_extension")
async def test_spatialite_version_info():
ds = Datasette(sqlite_extensions=["spatialite"])
response = await ds.client.get("/-/versions.json")

Wyświetl plik

@ -1,3 +1,6 @@
from datasette.utils.sqlite import sqlite3
def assert_footer_links(soup):
footer_links = soup.find("footer").findAll("a")
assert 4 == len(footer_links)
@ -22,3 +25,8 @@ def inner_html(soup):
# This includes the parent tag - so remove that
inner_html = html.split(">", 1)[1].rsplit("<", 1)[0]
return inner_html.strip()
def has_load_extension():
conn = sqlite3.connect(":memory:")
return hasattr(conn, "enable_load_extension")