From 4c07eb8841456c8ed76a0a45e3821d03f6c9839a Mon Sep 17 00:00:00 2001 From: Chris Sewell Date: Sun, 27 Oct 2024 16:35:08 +0000 Subject: [PATCH] increase test coverage --- sphinx_needs/needs.py | 4 ++-- tests/doc_test/extra_options/conf.py | 2 ++ tests/test_extra_options.py | 4 +++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/sphinx_needs/needs.py b/sphinx_needs/needs.py index da129ce3d..e5a19d1fd 100644 --- a/sphinx_needs/needs.py +++ b/sphinx_needs/needs.py @@ -429,7 +429,7 @@ def load_config(app: Sphinx, *_args: Any) -> None: except KeyError: log_warning( LOGGER, - f"Extra option is a dict, but does not contain a 'name' key: {option}", + f"extra_option is a dict, but does not contain a 'name' key: {option}", "config", None, ) @@ -438,7 +438,7 @@ def load_config(app: Sphinx, *_args: Any) -> None: else: log_warning( LOGGER, - f"Extra option is not a string or dict: {option}", + f"extra_option is not a string or dict: {option}", "config", None, ) diff --git a/tests/doc_test/extra_options/conf.py b/tests/doc_test/extra_options/conf.py index e0d6e07ba..52b0b468b 100644 --- a/tests/doc_test/extra_options/conf.py +++ b/tests/doc_test/extra_options/conf.py @@ -4,6 +4,8 @@ "introduced", "updated", {"name": "impacts", "description": "What is the impact of this need?"}, + {}, + 1, ] needs_build_json = True diff --git a/tests/test_extra_options.py b/tests/test_extra_options.py index 86759f78f..346395ec1 100644 --- a/tests/test_extra_options.py +++ b/tests/test_extra_options.py @@ -18,7 +18,9 @@ def test_custom_attributes_appear(test_app, snapshot): warnings = strip_colors(app._warning.getvalue()).splitlines() assert warnings == [ - 'WARNING: extra_option "introduced" already registered. [needs.config]' + 'WARNING: extra_option "introduced" already registered. [needs.config]', + "WARNING: extra_option is a dict, but does not contain a 'name' key: {} [needs.config]", + "WARNING: extra_option is not a string or dict: 1 [needs.config]", ] needs = json.loads(Path(app.outdir, "needs.json").read_text("utf8"))