{"html_url": "https://github.com/simonw/datasette/issues/771#issuecomment-634916313", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/771", "id": 634916313, "node_id": "MDEyOklzc3VlQ29tbWVudDYzNDkxNjMxMw==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2020-05-27T20:17:13Z", "updated_at": "2020-05-27T20:17:13Z", "author_association": "OWNER", "body": "Closed in da87e963bff24e47878a5bc2025c8bfc63d4bc93", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 625980317, "label": "Unit test that checks that all plugin hooks have corresponding unit tests"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/771#issuecomment-634915104", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/771", "id": 634915104, "node_id": "MDEyOklzc3VlQ29tbWVudDYzNDkxNTEwNA==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2020-05-27T20:14:32Z", "updated_at": "2020-05-27T20:14:32Z", "author_association": "OWNER", "body": "```\r\n$ pytest -k test_plugin_hooks_have_tests -vv\r\n====================================== test session starts ======================================\r\nplatform darwin -- Python 3.7.7, pytest-5.2.4, py-1.8.1, pluggy-0.13.1 -- /Users/simon/.local/share/virtualenvs/datasette-AWNrQs95/bin/python\r\ncachedir: .pytest_cache\r\nrootdir: /Users/simon/Dropbox/Development/datasette, inifile: pytest.ini\r\nplugins: asyncio-0.10.0\r\ncollected 486 items / 475 deselected / 11 selected \r\n\r\ntests/test_plugins.py::test_plugin_hooks_have_tests[asgi_wrapper] XPASS [ 9%]\r\ntests/test_plugins.py::test_plugin_hooks_have_tests[extra_body_script] XPASS [ 18%]\r\ntests/test_plugins.py::test_plugin_hooks_have_tests[extra_css_urls] XPASS [ 27%]\r\ntests/test_plugins.py::test_plugin_hooks_have_tests[extra_js_urls] XPASS [ 36%]\r\ntests/test_plugins.py::test_plugin_hooks_have_tests[extra_template_vars] XPASS [ 45%]\r\ntests/test_plugins.py::test_plugin_hooks_have_tests[prepare_connection] XPASS [ 54%]\r\ntests/test_plugins.py::test_plugin_hooks_have_tests[prepare_jinja2_environment] XFAIL [ 63%]\r\ntests/test_plugins.py::test_plugin_hooks_have_tests[publish_subcommand] XFAIL [ 72%]\r\ntests/test_plugins.py::test_plugin_hooks_have_tests[register_facet_classes] XFAIL [ 81%]\r\ntests/test_plugins.py::test_plugin_hooks_have_tests[register_output_renderer] XFAIL [ 90%]\r\ntests/test_plugins.py::test_plugin_hooks_have_tests[render_cell] XPASS [100%]\r\n\r\n========================= 475 deselected, 4 xfailed, 7 xpassed in 1.70s =========================", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 625980317, "label": "Unit test that checks that all plugin hooks have corresponding unit tests"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/771#issuecomment-634909818", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/771", "id": 634909818, "node_id": "MDEyOklzc3VlQ29tbWVudDYzNDkwOTgxOA==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2020-05-27T20:02:52Z", "updated_at": "2020-05-27T20:02:52Z", "author_association": "OWNER", "body": "Actually I'll land this using `@pytest.mark.xfail`.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 625980317, "label": "Unit test that checks that all plugin hooks have corresponding unit tests"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/771#issuecomment-634909347", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/771", "id": 634909347, "node_id": "MDEyOklzc3VlQ29tbWVudDYzNDkwOTM0Nw==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2020-05-27T20:01:52Z", "updated_at": "2020-05-27T20:01:52Z", "author_association": "OWNER", "body": "I'll do the work for this in the pull request #772.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 625980317, "label": "Unit test that checks that all plugin hooks have corresponding unit tests"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/771#issuecomment-634900776", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/771", "id": 634900776, "node_id": "MDEyOklzc3VlQ29tbWVudDYzNDkwMDc3Ng==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2020-05-27T19:44:25Z", "updated_at": "2020-05-27T19:44:25Z", "author_association": "OWNER", "body": "This seems to work:\r\n```diff\r\ndiff --git a/tests/test_plugins.py b/tests/test_plugins.py\r\nindex 8b6a6b4..e9a40aa 100644\r\n--- a/tests/test_plugins.py\r\n+++ b/tests/test_plugins.py\r\n@@ -7,7 +7,7 @@ from .fixtures import (\r\n TestClient as _TestClient,\r\n ) # noqa\r\n from datasette.app import Datasette\r\n-from datasette.plugins import get_plugins, DEFAULT_PLUGINS\r\n+from datasette.plugins import get_plugins, DEFAULT_PLUGINS, pm\r\n from datasette.utils import sqlite3\r\n import base64\r\n import json\r\n@@ -20,6 +20,21 @@ import pytest\r\n import urllib\r\n \r\n \r\n+def test_plugin_hooks_have_tests():\r\n+ \"Every plugin hook should be referenced in this test module\"\r\n+ hooks = [name for name in dir(pm.hook) if not name.startswith(\"_\")]\r\n+ tests_in_this_module = [t for t in globals().keys() if t.startswith('test_')]\r\n+ untested = []\r\n+ for hook in hooks:\r\n+ ok = False\r\n+ for test in tests_in_this_module:\r\n+ if hook in test:\r\n+ ok = True\r\n+ if not ok:\r\n+ untested.append(hook)\r\n+ assert not untested, 'These plugin hooks are missing tests: {}'.format(untested)\r\n+\r\n+\r\n def test_plugins_dir_plugin_prepare_connection(app_client):\r\n response = app_client.get(\r\n \"/fixtures.json?sql=select+convert_units(100%2C+'m'%2C+'ft')\"\r\n```\r\nBased on how the documentation unit tests work.\r\n\r\nCurrently fails with:\r\n\r\n AssertionError: These plugin hooks are missing tests:\r\n ['prepare_jinja2_environment', 'publish_subcommand', 'register_facet_classes', 'register_output_renderer']\r\n", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 625980317, "label": "Unit test that checks that all plugin hooks have corresponding unit tests"}, "performed_via_github_app": null}