Skip to main content

Pytest plugin for WCAG 2.1 A/AA/AAA compliance checks on PDFs.

Project description

Swarmauri Logo

PyPI - Downloads Hits PyPI - Python Version PyPI - License PyPI - wcag-pdf-pytest


wcag-pdf-pytest

wcag-pdf-pytest is a pytest plugin that scaffolds WCAG 2.1 compliance testing for PDF documents. The plugin auto-generates one test per WCAG 2.1 Success Criterion (SC) that applies to PDFs, organizes them by conformance level, and exposes CLI switches for narrowing execution to the criteria relevant to your review.

Features

  • SC-aware test generation — each applicable WCAG 2.1 SC ships as an individual pytest module with structured docstrings that document the requirement.
  • Level-based selection — mark sets (A, AA, AAA) and CLI flags allow you to focus on the conformance tier under audit.
  • Context-aware filtering — opt-in inclusion of "Depends" criteria lets you decide when to execute context-sensitive checks.
  • Extensible PDF inspection — centralize heavy lifting in pdf_inspector.py so new assertions or document parsers can be layered in without touching the generated tests.

Installation

pip

pip install wcag-pdf-pytest[pdf]

uv

uv add wcag-pdf-pytest[pdf]

Install the optional pdf extra when you need the bundled pypdf helpers.

Usage

Run the full WCAG 2.1 test suite against a PDF document:

pytest --wcag-pdf path/to/file.pdf

Execute only Level AA criteria using pytest markers:

pytest -m "AA" --wcag-pdf path/to/file.pdf

The plugin also exposes explicit CLI options:

pytest --wcag-pdf-level AA --wcag-pdf path/to/file.pdf
pytest --wcag-pdf-include-depends --wcag-pdf path/to/file.pdf

Tests are namespaced under the wcag21 marker to keep discovery isolated from other pytest plugins. Each test is seeded with an xfail placeholder so you can progressively replace the stub assertion with a concrete PDF accessibility check.

CLI reference

Option Description
--wcag-pdf Path to one or more PDF files to validate.
--wcag-pdf-level {A,AA,AAA} Restrict execution to a specific WCAG level.
--wcag-pdf-include-depends Execute context-dependent criteria flagged as "Depends".

Combine CLI switches with pytest marker expressions for granular selection during CI runs.

Extending PDF checks

Extend wcag_pdf_pytest/pdf_inspector.py with reusable utilities that evaluate individual criteria. Generated tests should stay declarative — import helpers from the inspector module to keep assertions maintainable and consistent across the suite.

License

Apache License 2.0. See LICENSE for details.

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

wcag_pdf_pytest-0.2.2.dev16.tar.gz (21.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

wcag_pdf_pytest-0.2.2.dev16-py3-none-any.whl (58.4 kB view details)

Uploaded Python 3

File details

Details for the file wcag_pdf_pytest-0.2.2.dev16.tar.gz.

File metadata

  • Download URL: wcag_pdf_pytest-0.2.2.dev16.tar.gz
  • Upload date:
  • Size: 21.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.12 {"installer":{"name":"uv","version":"0.10.12","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for wcag_pdf_pytest-0.2.2.dev16.tar.gz
Algorithm Hash digest
SHA256 d8a7837056d9f71e5e60f23227f7e36f46a9d83231e9265276c7a83f5331857d
MD5 11e9a85fe2c61f9f78cf2d49ab9673ab
BLAKE2b-256 f8f602d79635c83f29c7b0653951b21eabbc5de0cc81bd0dbd47e14fe29b382b

See more details on using hashes here.

File details

Details for the file wcag_pdf_pytest-0.2.2.dev16-py3-none-any.whl.

File metadata

  • Download URL: wcag_pdf_pytest-0.2.2.dev16-py3-none-any.whl
  • Upload date:
  • Size: 58.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.12 {"installer":{"name":"uv","version":"0.10.12","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for wcag_pdf_pytest-0.2.2.dev16-py3-none-any.whl
Algorithm Hash digest
SHA256 566ccde5a9a41c91aa43c046e803812f1bc2deaaeb559eafcf7fed8ef34fe89d
MD5 474ad41d5af3298f7ecc7e246fe1f0df
BLAKE2b-256 fa06153e30995dee62738234ac5aea3eea4d188586ac5029db47416c07b073f7

See more details on using hashes here.

Supported by

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