Check links in files
Project description
pytest-check-links
pytest plugin that checks URLs for HTML-containing files.
Supported files
.html
.rst
.md
(TODO: select renderer).ipynb
(requiresnbconvert
)
Install
pip install pytest-check-links
Use
pytest --check-links mynotebook.ipynb
Configure
--links-ext
default:
md,rst,html,ipynb
A comma-separated list of extensions to check
--check-anchors
Also check whether links with #anchors
HTML files (either local, or with
served with html
in the Content-Type
) actually exist, and point to exactly one
named anchor.
Cache
Caching requires the installation of requests-cache
.
pip install requests-cache
If enabled, each occurance of a link will be checked, no matter how many times it appears in a collection of files to check.
--check-links-cache
Cache requests when checking links. Caching is disabled by default, and this option must be provided, even if other cache configuration options are provided.
--check-links-cache-name
default:
.pytest-check-links-cache
Name of link cache, either the base name of a file or similar, depending on backend.
--check-links-cache-backend
default:
sqlite3
Cache persistence backend. The other known backends are:
memory
redis
mongodb
See the requests-cache documentation for more information.
--check-links-cache-expire-after
default:
None
(unlimited)
Time to cache link responses (seconds).
--check-links-cache-backend-opt
Backend-specific options for link cache, provided as key:value
. These are passed
directly to the requests_cache.CachedSession
constructor, as they vary depending
on the backend.
Values will be parsed as JSON first, so to overload the default of caching all
HTTP response codes (which requires a list of int
s):
--check-links-backend-opt allowable_codes:[200]
TODO
- pick a markdown renderer (probably commonmark) or make the markdown renderer pluggable
- options for validating links (allow absolute links, only remote or local, etc.)
- find URLs in Python docstrings
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for pytest_check_links-0.4.3.dev7.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0c327d47d020fbc795aa4d81128e83137a31126c38504ca4e95bdab99a2d0260 |
|
MD5 | e1d02cdf02b13d5bea04023430f59ad2 |
|
BLAKE2b-256 | b364fb280aba676a024ab77433fdf133611d470d5cd72d34ecac97fcb9b576e7 |
Hashes for pytest_check_links-0.4.3.dev7-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f3fd92e56eff906b574f24098186648abe1a5c004168a0343863d9cecc03f773 |
|
MD5 | ea647b4ca7096b65b2d40db0698c4e63 |
|
BLAKE2b-256 | 86ae417215d36412fb8713fcd25c2db35c79a1f6f1409f512c8abbfba7909210 |