mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
Run sanity checks, not .inspect(), on startup
Also fixes tests that did NOT like a call to run_until_complete in the Datasette() constructor.
This commit is contained in:
parent
da0b3ce2b7
commit
24bf79d2f0
3 changed files with 5 additions and 4 deletions
|
|
@ -344,8 +344,6 @@ class Datasette:
|
||||||
except ValueError:
|
except ValueError:
|
||||||
# Plugin already registered
|
# Plugin already registered
|
||||||
pass
|
pass
|
||||||
# Run the sanity checks
|
|
||||||
asyncio.get_event_loop().run_until_complete(self.run_sanity_checks())
|
|
||||||
|
|
||||||
async def run_sanity_checks(self):
|
async def run_sanity_checks(self):
|
||||||
# Only one check right now, for Spatialite
|
# Only one check right now, for Spatialite
|
||||||
|
|
|
||||||
|
|
@ -412,6 +412,8 @@ def serve(
|
||||||
memory=memory,
|
memory=memory,
|
||||||
version_note=version_note,
|
version_note=version_note,
|
||||||
)
|
)
|
||||||
# Force initial hashing/table counting
|
# Run async sanity checks - but only if we're not under pytest
|
||||||
ds.inspect()
|
asyncio.get_event_loop().run_until_complete(ds.run_sanity_checks())
|
||||||
|
|
||||||
|
# Start the server
|
||||||
ds.app().run(host=host, port=port, debug=debug)
|
ds.app().run(host=host, port=port, debug=debug)
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,7 @@ def pytest_collection_modifyitems(items):
|
||||||
move_to_front(items, "test_black")
|
move_to_front(items, "test_black")
|
||||||
move_to_front(items, "test_inspect_cli")
|
move_to_front(items, "test_inspect_cli")
|
||||||
move_to_front(items, "test_inspect_cli_writes_to_file")
|
move_to_front(items, "test_inspect_cli_writes_to_file")
|
||||||
|
move_to_front(items, "test_spatialite_error_if_attempt_to_open_spatialite")
|
||||||
|
|
||||||
|
|
||||||
def move_to_front(items, test_name):
|
def move_to_front(items, test_name):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue