kopia lustrzana https://github.com/simonw/datasette
Skip SpatiaLite test if no conn.enable_load_extension()
Ran into this problem while working on #1802pull/1803/head
rodzic
b91e17280c
commit
b2b901e8c4
|
@ -1,5 +1,6 @@
|
||||||
from datasette.app import Datasette
|
from datasette.app import Datasette
|
||||||
from datasette.utils import find_spatialite, SpatialiteNotFound, SPATIALITE_FUNCTIONS
|
from datasette.utils import find_spatialite, SpatialiteNotFound, SPATIALITE_FUNCTIONS
|
||||||
|
from .utils import has_load_extension
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
|
|
||||||
|
@ -13,6 +14,7 @@ def has_spatialite():
|
||||||
|
|
||||||
@pytest.mark.asyncio
|
@pytest.mark.asyncio
|
||||||
@pytest.mark.skipif(not has_spatialite(), reason="Requires SpatiaLite")
|
@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():
|
async def test_spatialite_version_info():
|
||||||
ds = Datasette(sqlite_extensions=["spatialite"])
|
ds = Datasette(sqlite_extensions=["spatialite"])
|
||||||
response = await ds.client.get("/-/versions.json")
|
response = await ds.client.get("/-/versions.json")
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
from datasette.utils.sqlite import sqlite3
|
||||||
|
|
||||||
|
|
||||||
def assert_footer_links(soup):
|
def assert_footer_links(soup):
|
||||||
footer_links = soup.find("footer").findAll("a")
|
footer_links = soup.find("footer").findAll("a")
|
||||||
assert 4 == len(footer_links)
|
assert 4 == len(footer_links)
|
||||||
|
@ -22,3 +25,8 @@ def inner_html(soup):
|
||||||
# This includes the parent tag - so remove that
|
# This includes the parent tag - so remove that
|
||||||
inner_html = html.split(">", 1)[1].rsplit("<", 1)[0]
|
inner_html = html.split(">", 1)[1].rsplit("<", 1)[0]
|
||||||
return inner_html.strip()
|
return inner_html.strip()
|
||||||
|
|
||||||
|
|
||||||
|
def has_load_extension():
|
||||||
|
conn = sqlite3.connect(":memory:")
|
||||||
|
return hasattr(conn, "enable_load_extension")
|
||||||
|
|
Ładowanie…
Reference in New Issue