diff --git a/tests/test_plugins.py b/tests/test_plugins.py index 8b6a6b417b..1546de92ad 100644 --- a/tests/test_plugins.py +++ b/tests/test_plugins.py @@ -7,7 +7,7 @@ TestClient as _TestClient, ) # noqa from datasette.app import Datasette -from datasette.plugins import get_plugins, DEFAULT_PLUGINS +from datasette.plugins import get_plugins, DEFAULT_PLUGINS, pm from datasette.utils import sqlite3 import base64 import json @@ -20,6 +20,20 @@ import urllib +@pytest.mark.xfail +@pytest.mark.parametrize( + "plugin_hook", [name for name in dir(pm.hook) if not name.startswith("_")] +) +def test_plugin_hooks_have_tests(plugin_hook): + "Every plugin hook should be referenced in this test module" + tests_in_this_module = [t for t in globals().keys() if t.startswith("test_")] + ok = False + for test in tests_in_this_module: + if plugin_hook in test: + ok = True + assert ok, "Plugin hook is missing tests: {}".format(plugin_hook) + + def test_plugins_dir_plugin_prepare_connection(app_client): response = app_client.get( "/fixtures.json?sql=select+convert_units(100%2C+'m'%2C+'ft')"