From ccf1866d25862500212643be69ee4fafce27d5df Mon Sep 17 00:00:00 2001 From: Christian Roth Date: Mon, 6 Dec 2021 17:11:56 +0100 Subject: [PATCH] update and verify info for excluded documents --- sphinx/builders/linkcheck.py | 5 ++++- tests/test_build_linkcheck.py | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/sphinx/builders/linkcheck.py b/sphinx/builders/linkcheck.py index c8fc040a6f1..9610b29320f 100644 --- a/sphinx/builders/linkcheck.py +++ b/sphinx/builders/linkcheck.py @@ -383,7 +383,10 @@ def check(docname: str) -> Tuple[str, str, int]: for doc_matcher in self.documents_exclude: if doc_matcher.match(docname): - info = f'{docname} matched {doc_matcher} from linkcheck_exclude_documents' + info = ( + f'{docname} matched {doc_matcher.pattern} from ' + 'linkcheck_exclude_documents' + ) return 'ignored', info, 0 if len(uri) == 0 or uri.startswith(('#', 'mailto:', 'tel:')): diff --git a/tests/test_build_linkcheck.py b/tests/test_build_linkcheck.py index 0520fb016a7..36250217ff9 100644 --- a/tests/test_build_linkcheck.py +++ b/tests/test_build_linkcheck.py @@ -631,7 +631,9 @@ def test_get_after_head_raises_connection_error(app): def test_linkcheck_exclude_documents(app): app.build() + ignore_reg = re.compile('.* matched .* from linkcheck_exclude_documents') with open(app.outdir / 'output.json') as fp: for record in fp: content = json.loads(record) assert content['status'] == 'ignored' + assert ignore_reg.match(content['info'])