kopia lustrzana https://github.com/simonw/datasette
Ensure db.path is a string before trying to insert into internal database (#1370)
Thanks, @eyeseastpull/1368/head
rodzic
5335f360f4
commit
a6c55afe8c
|
@ -354,7 +354,7 @@ class Datasette:
|
||||||
INSERT OR REPLACE INTO databases (database_name, path, is_memory, schema_version)
|
INSERT OR REPLACE INTO databases (database_name, path, is_memory, schema_version)
|
||||||
VALUES (?, ?, ?, ?)
|
VALUES (?, ?, ?, ?)
|
||||||
""",
|
""",
|
||||||
[database_name, db.path, db.is_memory, schema_version],
|
[database_name, str(db.path), db.is_memory, schema_version],
|
||||||
block=True,
|
block=True,
|
||||||
)
|
)
|
||||||
await populate_schema_tables(internal_db, db)
|
await populate_schema_tables(internal_db, db)
|
||||||
|
|
|
@ -25,6 +25,7 @@ from .fixtures import ( # noqa
|
||||||
METADATA,
|
METADATA,
|
||||||
)
|
)
|
||||||
import json
|
import json
|
||||||
|
import pathlib
|
||||||
import pytest
|
import pytest
|
||||||
import sys
|
import sys
|
||||||
import urllib
|
import urllib
|
||||||
|
@ -2123,3 +2124,16 @@ def test_col_nocol_errors(app_client, path, expected_error):
|
||||||
response = app_client.get(path)
|
response = app_client.get(path)
|
||||||
assert response.status == 400
|
assert response.status == 400
|
||||||
assert response.json["error"] == expected_error
|
assert response.json["error"] == expected_error
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.asyncio
|
||||||
|
async def test_db_path(app_client):
|
||||||
|
db = app_client.ds.get_database()
|
||||||
|
path = pathlib.Path(db.path)
|
||||||
|
|
||||||
|
assert path.exists()
|
||||||
|
|
||||||
|
datasette = Datasette([path])
|
||||||
|
|
||||||
|
# this will break with a path
|
||||||
|
await datasette.refresh_schemas()
|
||||||
|
|
Ładowanie…
Reference in New Issue