mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
Switch from pkg_resources to importlib.metadata in app.py, refs #2057
This commit is contained in:
parent
16f0b6d822
commit
852f501485
2 changed files with 25 additions and 3 deletions
|
|
@ -1264,3 +1264,25 @@ async def test_hook_actors_from_ids():
|
|||
}
|
||||
finally:
|
||||
pm.unregister(name="ReturnNothingPlugin")
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_plugin_is_installed():
|
||||
datasette = Datasette(memory=True)
|
||||
|
||||
class DummyPlugin:
|
||||
__name__ = "DummyPlugin"
|
||||
|
||||
@hookimpl
|
||||
def actors_from_ids(self, datasette, actor_ids):
|
||||
return {}
|
||||
|
||||
try:
|
||||
pm.register(DummyPlugin(), name="DummyPlugin")
|
||||
response = await datasette.client.get("/-/plugins.json")
|
||||
assert response.status_code == 200
|
||||
installed_plugins = {p["name"] for p in response.json()}
|
||||
assert "DummyPlugin" in installed_plugins
|
||||
|
||||
finally:
|
||||
pm.unregister(name="DummyPlugin")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue