Skip to content

Commit 0d8c92b

Browse files
authored
Make rediraffe_redirects default None (#17)
* Make rediraffe_redirects default None Otherwise shinx logs warning: WARNING: The config value `rediraffe_redirects' has type `dict', defaults to `str'. * fix tests
1 parent 4026ec2 commit 0d8c92b

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

sphinxext/rediraffe.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,7 @@ def init(self) -> None:
400400

401401

402402
def setup(app: Sphinx) -> Dict[str, Any]:
403-
app.add_config_value("rediraffe_redirects", "", None)
403+
app.add_config_value("rediraffe_redirects", None, None)
404404
app.add_config_value("rediraffe_branch", "", None)
405405
app.add_config_value("rediraffe_template", None, None)
406406
app.add_config_value("rediraffe_auto_redirect_perc", 100, None)

tests/test_ext.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,8 @@ def test_bad_rediraffe_file(self, app: Sphinx):
9494
@pytest.mark.sphinx("html", testroot="no_rediraffe_file")
9595
def test_no_rediraffe_file(self, app: Sphinx):
9696
app.build()
97-
assert app.statuscode == 1
97+
assert app.statuscode == 0
98+
assert "rediraffe was not given redirects to process" in app._warning.getvalue()
9899

99100
@pytest.mark.sphinx("html", testroot="redirect_from_deleted_folder")
100101
def test_redirect_from_deleted_folder(self, app: Sphinx, ensure_redirect):
@@ -277,7 +278,8 @@ def test_bad_rediraffe_file(self, app: Sphinx):
277278
@pytest.mark.sphinx("dirhtml", testroot="no_rediraffe_file")
278279
def test_no_rediraffe_file(self, app: Sphinx):
279280
app.build()
280-
assert app.statuscode == 1
281+
assert app.statuscode == 0
282+
assert "rediraffe was not given redirects to process" in app._warning.getvalue()
281283

282284
@pytest.mark.sphinx("dirhtml", testroot="redirect_from_deleted_folder")
283285
def test_redirect_from_deleted_folder(self, app: Sphinx, ensure_redirect):

0 commit comments

Comments
 (0)