Skip to content

Commit

Permalink
update and verify info for excluded documents
Browse files Browse the repository at this point in the history
  • Loading branch information
croth1 committed Dec 6, 2021
1 parent 046f788 commit ccf1866
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 4 additions & 1 deletion sphinx/builders/linkcheck.py
Expand Up @@ -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:')):
Expand Down
2 changes: 2 additions & 0 deletions tests/test_build_linkcheck.py
Expand Up @@ -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'])

0 comments on commit ccf1866

Please sign in to comment.