to better cover the current link check ignore configuration
 behavior
This commit is contained in:
Timotheus Kampik
2018-07-16 23:17:44 +02:00
parent 3e57ea0a52
commit c126067f4e
2 changed files with 12 additions and 3 deletions

View File

@@ -9,3 +9,5 @@ Some additional anchors to exercise ignore code
* `Example Bar invalid <http://example.com/#!bar>`_
* `Example Bar invalid <http://example.com#!bar>`_ tests that default ignore anchor of #! does not need to be prefixed with /
* `Example Bar invalid <http://example.com/#top>`_
* `Example anchor invalid <http://www.sphinx-doc.org/en/1.7/intro.html#does-not-exist>`_
* `Complete nonsense <https://localhost:7777/doesnotexist>`_

View File

@@ -21,14 +21,21 @@ def test_defaults(app, status, warning):
content = (app.outdir / 'output.txt').text()
print(content)
# looking for #top should fail
# looking for '#top' and 'does-not-exist' not found should fail
assert "Anchor 'top' not found" in content
assert len(content.splitlines()) == 1
assert "Anchor 'does-not-exist' not found" in content
# looking for non-existent URL should fail
assert " Max retries exceeded with url: /doesnotexist" in content
assert len(content.splitlines()) == 3
@pytest.mark.sphinx(
'linkcheck', testroot='linkcheck', freshenv=True,
confoverrides={'linkcheck_anchors_ignore': ["^!", "^top$"]})
confoverrides={'linkcheck_anchors_ignore': ["^!", "^top$"],
'linkcheck_ignore': [
'https://localhost:7777/doesnotexist',
'http://www.sphinx-doc.org/en/1.7/intro.html#*']
})
def test_anchors_ignored(app, status, warning):
app.builder.build_all()