chiark / gitweb /
documentation/python: ensure all plugin hooks are always tested.
authorVladimír Vondruš <mosra@centrum.cz>
Sun, 2 Jan 2022 12:06:08 +0000 (13:06 +0100)
committerVladimír Vondruš <mosra@centrum.cz>
Sun, 2 Jan 2022 16:23:42 +0000 (17:23 +0100)
documentation/test_python/page_plugins/plugins/fancyline.py

index c71995a3dbc2d5169f6d1facf10592a9853e855a..b7f2894ba1960d9dc5b08962b456356fe0de5458 100644 (file)
@@ -69,7 +69,16 @@ def _post_run(**kwargs):
     global post_run_call_count
     post_run_call_count = post_run_call_count + 1
 
-def register_mcss(hooks_post_crawl, hooks_pre_scope, hooks_post_scope, hooks_docstring, hooks_pre_page, hooks_post_run, **kwargs):
+def register_mcss(
+    # The * is to ensure all arguments are passed as keyword
+    *, hooks_post_crawl, hooks_pre_scope, hooks_post_scope, hooks_docstring, hooks_pre_page, hooks_post_run,
+    # These are not used here, but requiring them to ensure these get passed
+    # always
+    mcss_settings, jinja_environment, module_doc_contents, class_doc_contents, enum_doc_contents, enum_value_doc_contents, function_doc_contents, property_doc_contents, data_doc_contents,
+    # This is asserted to be empty below to ensure the test is always updated
+    # for newly added hooks
+    **kwargs) \
+:
     hooks_post_crawl += [_post_crawl]
     hooks_pre_scope += [_pre_scope]
     hooks_post_scope += [_post_scope]
@@ -77,4 +86,7 @@ def register_mcss(hooks_post_crawl, hooks_pre_scope, hooks_post_scope, hooks_doc
     hooks_pre_page += [_pre_page]
     hooks_post_run += [_post_run]
 
+    # To ensure the test is always updated for newly added hooks
+    assert not kwargs, "Expected empty kwargs but got %s" % kwargs
+
     rst.directives.register_directive('fancy-line', FancyLine)