GitHub

PyPI

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() == """\ /index.rst">

Read the original on github.com ↗