|
ds = Datasette(files, **kwargs) |
|
|
|
if get: |
|
client = TestClient(ds.app()) |
|
response = client.get(get) |
|
click.echo(response.text) |
|
return |
|
|
|
if return_instance: |
|
# Private utility mechanism for writing unit tests |
|
return ds |
|
|
|
# Run the "startup" plugin hooks |
|
asyncio.get_event_loop().run_until_complete(ds.invoke_startup()) |
|
|
|
# Run async sanity checks - but only if we're not under pytest |
|
asyncio.get_event_loop().run_until_complete(check_databases(ds)) |
Spotted this working on simonw/latest-datasette-with-all-plugins#3 - I'd like to be able to use datasette --get / as a sanity checking test, but that doesn't work if the init hooks aren't fully executed.
datasette/datasette/cli.py
Lines 417 to 433 in 7702ea6
Spotted this working on simonw/latest-datasette-with-all-plugins#3 - I'd like to be able to use
datasette --get /as a sanity checking test, but that doesn't work if the init hooks aren't fully executed.