mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
[config] correctly synchronize `root_doc and master_doc` (#12417)
This commit is contained in:
@@ -292,7 +292,7 @@ class AnchorsIgnoreForUrlHandler(BaseHTTPRequestHandler):
|
||||
@pytest.mark.sphinx('linkcheck', testroot='linkcheck-anchors-ignore-for-url', freshenv=True)
|
||||
def test_anchors_ignored_for_url(app: Sphinx) -> None:
|
||||
with serve_application(app, AnchorsIgnoreForUrlHandler) as address:
|
||||
app.config.linkcheck_anchors_ignore_for_url = [ # type: ignore[attr-defined]
|
||||
app.config.linkcheck_anchors_ignore_for_url = [
|
||||
f'http://{address}/ignored', # existing page
|
||||
f'http://{address}/invalid', # unknown page
|
||||
]
|
||||
@@ -402,7 +402,7 @@ def custom_handler(valid_credentials=(), success_criteria=lambda _: True):
|
||||
@pytest.mark.sphinx('linkcheck', testroot='linkcheck-localserver', freshenv=True)
|
||||
def test_auth_header_uses_first_match(app: Sphinx) -> None:
|
||||
with serve_application(app, custom_handler(valid_credentials=("user1", "password"))) as address:
|
||||
app.config.linkcheck_auth = [ # type: ignore[attr-defined]
|
||||
app.config.linkcheck_auth = [
|
||||
(r'^$', ('no', 'match')),
|
||||
(fr'^http://{re.escape(address)}/$', ('user1', 'password')),
|
||||
(r'.*local.*', ('user2', 'hunter2')),
|
||||
@@ -456,7 +456,7 @@ def test_linkcheck_request_headers(app: Sphinx) -> None:
|
||||
return self.headers["Accept"] == "text/html"
|
||||
|
||||
with serve_application(app, custom_handler(success_criteria=check_headers)) as address:
|
||||
app.config.linkcheck_request_headers = { # type: ignore[attr-defined]
|
||||
app.config.linkcheck_request_headers = {
|
||||
f"http://{address}/": {"Accept": "text/html"},
|
||||
"*": {"X-Secret": "open sesami"},
|
||||
}
|
||||
@@ -476,7 +476,7 @@ def test_linkcheck_request_headers_no_slash(app: Sphinx) -> None:
|
||||
return self.headers["Accept"] == "application/json"
|
||||
|
||||
with serve_application(app, custom_handler(success_criteria=check_headers)) as address:
|
||||
app.config.linkcheck_request_headers = { # type: ignore[attr-defined]
|
||||
app.config.linkcheck_request_headers = {
|
||||
f"http://{address}": {"Accept": "application/json"},
|
||||
"*": {"X-Secret": "open sesami"},
|
||||
}
|
||||
@@ -579,7 +579,7 @@ def test_follows_redirects_on_GET(app, capsys, warning):
|
||||
@pytest.mark.sphinx('linkcheck', testroot='linkcheck-localserver-warn-redirects')
|
||||
def test_linkcheck_allowed_redirects(app: Sphinx, warning: StringIO) -> None:
|
||||
with serve_application(app, make_redirect_handler(support_head=False)) as address:
|
||||
app.config.linkcheck_allowed_redirects = {f'http://{address}/.*1': '.*'} # type: ignore[attr-defined]
|
||||
app.config.linkcheck_allowed_redirects = {f'http://{address}/.*1': '.*'}
|
||||
compile_linkcheck_allowed_redirects(app, app.config)
|
||||
app.build()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user