From d3f59c40930c00f954ea8954d1b05b80787e512c Mon Sep 17 00:00:00 2001 From: Christian Roth Date: Mon, 6 Dec 2021 17:33:59 +0100 Subject: [PATCH] verify full record struct --- tests/test_build_linkcheck.py | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/tests/test_build_linkcheck.py b/tests/test_build_linkcheck.py index 36250217ff9..cfb508808f4 100644 --- a/tests/test_build_linkcheck.py +++ b/tests/test_build_linkcheck.py @@ -631,9 +631,24 @@ 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']) + content = [json.loads(record) for record in fp] + + assert content == [ + { + 'filename': 'broken_link.rst', + 'lineno': 4, + 'status': 'ignored', + 'code': 0, + 'uri': 'https://www.sphinx-doc.org/this-is-a-broken-link', + 'info': 'broken_link matched ^broken_link$ from linkcheck_exclude_documents', + }, + { + 'filename': 'br0ken_link.rst', + 'lineno': 4, + 'status': 'ignored', + 'code': 0, + 'uri': 'https://www.sphinx-doc.org/this-is-another-broken-link', + 'info': 'br0ken_link matched br[0-9]ken_link from linkcheck_exclude_documents', + }, + ]