Skip to main content

Check links in files

Project description


pytest plugin that checks URLs for HTML-containing files.

codecov Build Status PyPI version

Supported files

  • .html
  • .rst
  • .md (TODO: select renderer)
  • .ipynb (requires nbconvert)


pip install pytest-check-links


pytest --check-links mynotebook.ipynb



default: md,rst,html,ipynb

A comma-separated list of extensions to check


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.


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.


Cache requests when checking links. Caching is disabled by default, and this option must be provided, even if other cache configuration options are provided.


default: .pytest-check-links-cache

Name of link cache, either the base name of a file or similar, depending on backend.


default: sqlite3

Cache persistence backend. The other known backends are:

  • memory
  • redis
  • mongodb

See the requests-cache documentation for more information.


default: None (unlimited)

Time to cache link responses (seconds).


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 ints):

--check-links-backend-opt allowable_codes:[200]


  • 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

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pytest_check_links-0.4.3.dev7.tar.gz (14.9 kB view hashes)

Uploaded Source

Built Distribution

pytest_check_links-0.4.3.dev7-py3-none-any.whl (9.7 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page