fix: relax validation of autorefs settings

Signed-off-by: Timothée Mazzucotelli <dev@pawamoy.fr>
This commit is contained in:
Timothée Mazzucotelli
2026-09-11 19:42:50 +02:00
committed by GitHub
parent eac9e2444b
commit 6910d564a1
3 changed files with 30 additions and 2 deletions
+7 -1
View File
@@ -572,8 +572,14 @@ class TestPluginShimming:
)
def test_autorefs_standalone(self, tmp_path: Path) -> None:
config = self._parse_yaml(tmp_path, plugins={"autorefs": {}})
options = {
"resolve_closest": True,
"link_titles": "external",
"strip_title_tags": False,
}
config = self._parse_yaml(tmp_path, plugins={"autorefs": options})
assert AutorefsExtension.name in config["markdown_extensions"]
assert config["plugins"]["autorefs"]["config"] == {}
def test_autorefs_disabled_not_added(
self, monkeypatch: pytest.MonkeyPatch, tmp_path: Path
+14
View File
@@ -265,6 +265,20 @@ def test_accepts_supported_shim_options(
assert plugins[name]["config"] == config
@pytest.mark.parametrize(
"option", ["resolve_closest", "link_titles", "strip_title_tags"]
)
@pytest.mark.parametrize(
"value", [True, False, "auto", "external", 42, [], {}, None]
)
def test_silently_discards_unsupported_autorefs_options(
option: str, value: Any, capsys: pytest.CaptureFixture[str]
) -> None:
plugins = _convert_plugins({"autorefs": {"enabled": True, option: value}})
assert plugins["autorefs"]["config"] == {"enabled": True}
assert capsys.readouterr().err == ""
@pytest.mark.parametrize(
("name", "config", "message"),
[