From df7b6dd8c6691ff1a6b6cbf89e2fe0d358f102c5 Mon Sep 17 00:00:00 2001 From: Jeff Dairiki Date: Wed, 27 Jul 2022 10:14:03 -0700 Subject: [PATCH] Add htmltest environment to tox config --- .htmltest.yml | 2 ++ tox.ini | 35 ++++++++++++++++++++++++++++++----- 2 files changed, 32 insertions(+), 5 deletions(-) diff --git a/.htmltest.yml b/.htmltest.yml index f7afd545..c61aceaf 100644 --- a/.htmltest.yml +++ b/.htmltest.yml @@ -1,6 +1,8 @@ IgnoreAltMissing: true IgnoreURLs: - "^http://localhost:" + # For unknown reasons, htmltest reports a 404 on these one: + - "^https://twitter.com/" # htmltest does not like quotes around URL in meta refresh CheckMetaRefresh: false diff --git a/tox.ini b/tox.ini index 58f0faaa..4b732d7b 100644 --- a/tox.ini +++ b/tox.ini @@ -1,12 +1,37 @@ [tox] -minversion = 3 -envlist = py +minversion = 3.18 +envlist = build skipsdist = true [testenv] deps = lektor - jinja2>=3 +setenv = + # Keep Lektor's private package cache in tox env rather than ~/.cache + XDG_CACHE_HOME = {envdir}/cache + LOCALAPPDATA = {envdir}/cache + +[testenv:build] commands = - lektor plugins reinstall - lektor build + lektor build -O {envdir}/output + +[testenv:htmltest] +# Build site and check links with htmltest +# +# By default, only internal links are checked. +# +# tox -e htmltest +# +# To test external links as well, try (warning: slow): +# +# HTMLTEST_OPTS="" tox -e htmltest +# +allowlist_externals = + bash +commands_pre = + # Install latest version of htmltest in the tox env + bash -c '[ -f {envbindir}/htmltest ] || \ + curl -s https://htmltest.wjdp.uk | bash -s -- -b {envbindir}' +commands = + {[testenv:build]commands} + htmltest -c .htmltest.yml {env:HTMLTEST_OPTS:-s} {envdir}/output