From 1cecdf66198049c7ca48356d8349e2f07732764c Mon Sep 17 00:00:00 2001 From: Steffen Schroeder Date: Sat, 13 Jul 2019 16:06:56 +0200 Subject: [PATCH] Added checklinks to tox and release.py --- doc/en/conf.py | 13 +++++++++++++ scripts/release.py | 7 +++++++ tox.ini | 9 +++++++++ 3 files changed, 29 insertions(+) diff --git a/doc/en/conf.py b/doc/en/conf.py index 1a6ef7ca8..c0c71cf05 100644 --- a/doc/en/conf.py +++ b/doc/en/conf.py @@ -112,6 +112,19 @@ pygments_style = "sphinx" # A list of ignored prefixes for module index sorting. # modindex_common_prefix = [] +# A list of regular expressions that match URIs that should not be checked when +# doing a linkcheck. +linkcheck_ignore = [ + "https://github.com/numpy/numpy/blob/master/doc/release/1.16.0-notes.rst#new-deprecations", + "https://blogs.msdn.microsoft.com/bharry/2017/06/28/testing-in-a-cloud-delivery-cadence/", + "http://pythontesting.net/framework/pytest-introduction/", + r"https://github.com/pytest-dev/pytest/issues/\d+", + r"https://github.com/pytest-dev/pytest/pull/\d+", +] + +# The number of worker threads to use when checking links (default=5). +linkcheck_workers = 5 + # -- Options for HTML output --------------------------------------------------- diff --git a/scripts/release.py b/scripts/release.py index 5009df359..884d9bfb1 100644 --- a/scripts/release.py +++ b/scripts/release.py @@ -79,12 +79,19 @@ def fix_formatting(): call(["pre-commit", "run", "--all-files"]) +def check_links(): + """Runs sphinx-build to check links""" + print(f"{Fore.CYAN}[generate.check_links] {Fore.RESET}Checking links") + check_call(["tox", "-e", "docs-checklinks"]) + + def pre_release(version): """Generates new docs, release announcements and creates a local tag.""" announce(version) regen() changelog(version, write_out=True) fix_formatting() + check_links() msg = "Preparing release version {}".format(version) check_call(["git", "commit", "-a", "-m", msg]) diff --git a/tox.ini b/tox.ini index b03941657..d1a34c264 100644 --- a/tox.ini +++ b/tox.ini @@ -15,6 +15,7 @@ envlist = doctesting py37-freeze docs + docs-checklinks [testenv] commands = @@ -66,6 +67,14 @@ deps = -r{toxinidir}/doc/en/requirements.txt commands = sphinx-build -W -b html . _build +[testenv:docs-checklinks] +basepython = python3 +usedevelop = True +changedir = doc/en +deps = -r{toxinidir}/doc/en/requirements.txt +commands = + sphinx-build -W --keep-going -b linkcheck . _build + [testenv:doctesting] basepython = python3 skipsdist = True