sphinx-pytest
Helpful pytest fixtures for sphinx extensions.
Sphinx is annoying, because the modularity is not great, meaning that there is no real way just to convert single documents in isolation, etc.
This extension mainly provides some pytest fixtures to "simulate" converting some source text to docutils AST at different stages; before transforms, after transforms, etc.
Installation
pip install sphinx-pytest
Examples
from sphinx_pytest.plugin import CreateDoctree
def test_no_transforms(sphinx_doctree_no_tr: CreateDoctree):
"""Return the doctree, before any transforms have been applied."""
sphinx_doctree_no_tr.set_conf({"language": "en"})
result = sphinx_doctree_no_transforms(".. _target:\n\nheader\n------\n")
assert (
result.pformat()
== """\
<document source="<src>/index.rst">
<target ids="target" names="target">
<section ids="header" names="header">
<title>
header
""".rstrip()
)
def test_with_transforms(sphinx_doctree: CreateDoctree):
"""Return the doctree, after transforms (but not post-transforms)."""
result = sphinx_doctree(".. _target:\n\nheader\n------\n")
assert (
result.pformat()
== """\
<document source="<src>/index.rst">
<target refid="target">
<section ids="header target" names="header target">
<title>
header
""".rstrip()
)
Metadata
Release files for sphinx_pytest 0.3.0
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 |
|---|---|---|---|---|
| sphinx_pytest-0.3.0.tar.gz | 8.0 kB | Without provenance | Details for sphinx_pytest-0.3.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| sphinx_pytest-0.3.0-py3-none-any.whl | Python 3 | none | any | Details for sphinx_pytest-0.3.0-py3-none-any.whl |
Total release size: 13.8 kB
Release files / sphinx_pytest-0.3.0.tar.gz
| Download URL | sphinx_pytest-0.3.0.tar.gz |
|---|---|
| Size | 8.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
141a3d6b6cd8616ded72a949a2e7ba8b95e811e58f1118fa1ddeb8c61c3b6364
|
|
BLAKE2b-256 checksum How to use checksums |
4eb0b6123b64e27b37fada7291df8a482cb2dc6de0dc79bd75c4f97d65f6d96e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-requests/2.32.5
|
Release files / sphinx_pytest-0.3.0-py3-none-any.whl
| Download URL | sphinx_pytest-0.3.0-py3-none-any.whl |
|---|---|
| Size | 5.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
548bbf5be054efdf73c4a32fd685c86817afcccc51c7e2bd112f9905b34fd739
|
|
BLAKE2b-256 checksum How to use checksums |
15c5cee80eb395176413cbd91aa56ca1c9f8827c2d5fd97a424ef95087656437
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-requests/2.32.5
|
Security for sphinx_pytest 0.3.0
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.