Skip to content

--get doesn't fully invoke the startup routine #934

@simonw

Description

@simonw

datasette/datasette/cli.py

Lines 417 to 433 in 7702ea6

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions