Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

All plugin hooks should have unit tests #773

Closed
4 tasks done
simonw opened this issue May 27, 2020 · 2 comments
Closed
4 tasks done

All plugin hooks should have unit tests #773

simonw opened this issue May 27, 2020 · 2 comments

Comments

@simonw
Copy link
Owner

simonw commented May 27, 2020

Four hooks currently missing tests:

  • prepare_jinja2_environment
  • publish_subcommand
  • register_facet_classes
  • register_output_renderer
$ pytest -k test_plugin_hooks_have_tests -vv
====================================== test session starts ======================================
platform 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
cachedir: .pytest_cache
rootdir: /Users/simon/Dropbox/Development/datasette, inifile: pytest.ini
plugins: asyncio-0.10.0
collected 486 items / 475 deselected / 11 selected                                              

tests/test_plugins.py::test_plugin_hooks_have_tests[asgi_wrapper] XPASS                   [  9%]
tests/test_plugins.py::test_plugin_hooks_have_tests[extra_body_script] XPASS              [ 18%]
tests/test_plugins.py::test_plugin_hooks_have_tests[extra_css_urls] XPASS                 [ 27%]
tests/test_plugins.py::test_plugin_hooks_have_tests[extra_js_urls] XPASS                  [ 36%]
tests/test_plugins.py::test_plugin_hooks_have_tests[extra_template_vars] XPASS            [ 45%]
tests/test_plugins.py::test_plugin_hooks_have_tests[prepare_connection] XPASS             [ 54%]
tests/test_plugins.py::test_plugin_hooks_have_tests[prepare_jinja2_environment] XFAIL     [ 63%]
tests/test_plugins.py::test_plugin_hooks_have_tests[publish_subcommand] XFAIL             [ 72%]
tests/test_plugins.py::test_plugin_hooks_have_tests[register_facet_classes] XFAIL         [ 81%]
tests/test_plugins.py::test_plugin_hooks_have_tests[register_output_renderer] XFAIL       [ 90%]
tests/test_plugins.py::test_plugin_hooks_have_tests[render_cell] XPASS                    [100%]

========================= 475 deselected, 4 xfailed, 7 xpassed in 1.70s =========================

_Originally posted by @simonw in https://github.com/simonw/datasette/issues/771#issuecomment-634915104_
@simonw
Copy link
Owner Author

simonw commented May 27, 2020

Remove this xfail decorator once they are all tested:

@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"

@simonw
Copy link
Owner Author

simonw commented May 28, 2020

register_output_renderer test added in 52c4387#diff-56f7d7b4778bac73b6b655c02c8467aaR336

@simonw simonw closed this as completed in 6d95cb4 May 28, 2020
simonw added a commit that referenced this issue May 28, 2020
@simonw simonw added this to the Next planned release milestone May 28, 2020
simonw added a commit that referenced this issue May 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant