mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
Revert "Replace AsgiLifespan with AsgiRunOnFirstRequest, refs #1955"
This reverts commit dc18f62089.
This commit is contained in:
parent
38d28dd958
commit
0b68996cc5
5 changed files with 50 additions and 22 deletions
|
|
@ -902,14 +902,13 @@ Potential use-cases:
|
|||
|
||||
.. note::
|
||||
|
||||
If you are writing :ref:`unit tests <testing_plugins>` for a plugin that uses this hook and doesn't exercise Datasette by sending
|
||||
any simulated requests through it you will need to explicitly call ``await ds.invoke_startup()`` in your tests. An example:
|
||||
If you are writing :ref:`unit tests <testing_plugins>` for a plugin that uses this hook you will need to explicitly call ``await ds.invoke_startup()`` in your tests. An example:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_my_plugin():
|
||||
ds = Datasette()
|
||||
ds = Datasette([], metadata={})
|
||||
await ds.invoke_startup()
|
||||
# Rest of test goes here
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue