mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
Clean up compatibility with Pyodide (#1736)
* Optional uvicorn import for Pyodide, refs #1733 * --setting num_sql_threads 0 to disable threading, refs #1735
This commit is contained in:
parent
a29c127789
commit
3f00a29141
4 changed files with 42 additions and 4 deletions
|
|
@ -1,7 +1,7 @@
|
|||
"""
|
||||
Tests for the datasette.app.Datasette class
|
||||
"""
|
||||
from datasette.app import Datasette
|
||||
from datasette.app import Datasette, Database
|
||||
from itsdangerous import BadSignature
|
||||
from .fixtures import app_client
|
||||
import pytest
|
||||
|
|
@ -63,3 +63,15 @@ async def test_datasette_constructor():
|
|||
"hash": None,
|
||||
}
|
||||
]
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_num_sql_threads_zero():
|
||||
ds = Datasette([], memory=True, settings={"num_sql_threads": 0})
|
||||
db = ds.add_database(Database(ds, memory_name="test_num_sql_threads_zero"))
|
||||
await db.execute_write("create table t(id integer primary key)")
|
||||
await db.execute_write("insert into t (id) values (1)")
|
||||
response = await ds.client.get("/-/threads.json")
|
||||
assert response.json() == {"num_threads": 0, "threads": []}
|
||||
response2 = await ds.client.get("/test_num_sql_threads_zero/t.json?_shape=array")
|
||||
assert response2.json() == [{"id": 1}]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue