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.pyso 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.
Metadata
Release files for wcag_pdf_pytest 0.2.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| wcag_pdf_pytest-0.2.2.tar.gz | 21.3 kB | Without provenance | Details for wcag_pdf_pytest-0.2.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| wcag_pdf_pytest-0.2.2-py3-none-any.whl | Python 3 | none | any | Details for wcag_pdf_pytest-0.2.2-py3-none-any.whl |
Total release size: 79.7 kB
Release files / wcag_pdf_pytest-0.2.2.tar.gz
| Download URL | wcag_pdf_pytest-0.2.2.tar.gz |
|---|---|
| Size | 21.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f8ae6cdde9e4cf64ab060722e6ba4ce7ba006dd44688ac692a2a084a3a9fbca3
|
|
BLAKE2b-256 checksum How to use checksums |
5224fd095a411b229d1297fd374d4ffd740b8061e4908f4414fe7967b8cb5030
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.0 {"installer":{"name":"uv","version":"0.11.0","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}
|
Release files / wcag_pdf_pytest-0.2.2-py3-none-any.whl
| Download URL | wcag_pdf_pytest-0.2.2-py3-none-any.whl |
|---|---|
| Size | 58.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
33c8b35e0ee8fe9055c20a67de3f5eb6fca38cae91f237ab46c49f3457c6a9e5
|
|
BLAKE2b-256 checksum How to use checksums |
c84afeea47fcb3cfe6141878541a1fe5a8330f23a584abcccf043f9c0f27f40f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.0 {"installer":{"name":"uv","version":"0.11.0","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}
|
Security for wcag_pdf_pytest 0.2.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.