mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
Test that plugin hooks are unit tested (xfail)
This currently fails using xfail. Closes 771.
This commit is contained in:
parent
41a0cd7b6a
commit
da87e963bf
1 changed files with 15 additions and 1 deletions
|
|
@ -7,7 +7,7 @@ from .fixtures import (
|
|||
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 pytest
|
|||
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')"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue