Skip to content

Commit

Permalink
increase test coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisjsewell committed Oct 27, 2024
1 parent 63c64f1 commit 4c07eb8
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
4 changes: 2 additions & 2 deletions sphinx_needs/needs.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)
Expand All @@ -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,
)
Expand Down
2 changes: 2 additions & 0 deletions tests/doc_test/extra_options/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
"introduced",
"updated",
{"name": "impacts", "description": "What is the impact of this need?"},
{},
1,
]

needs_build_json = True
Expand Down
4 changes: 3 additions & 1 deletion tests/test_extra_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
Expand Down

0 comments on commit 4c07eb8

Please sign in to comment.