sphinx_pytest


Namesphinx_pytest JSON
Version 0.2.0 PyPI version JSON
download
home_pageNone
SummaryHelpful pytest fixtures for sphinx extensions.
upload_time2023-09-20 10:32:02
maintainerNone
docs_urlNone
authorNone
requires_python>=3.7
licenseNone
keywords sphinx pytest
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # sphinx-pytest

[![PyPI][pypi-badge]][pypi-link]

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

```python
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()
    )
```

```python
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()
    )
```


[pypi-badge]: https://img.shields.io/pypi/v/sphinx_pytest.svg
[pypi-link]: https://pypi.org/project/sphinx_pytest

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "sphinx_pytest",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": null,
    "keywords": "sphinx,pytest",
    "author": null,
    "author_email": "Chris Sewell <chrisj_sewell@hotmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/3e/9d/c83b6507b88f134a51fc97a952f627c327cf78189faaf857a93ef01ea1f8/sphinx_pytest-0.2.0.tar.gz",
    "platform": null,
    "description": "# sphinx-pytest\n\n[![PyPI][pypi-badge]][pypi-link]\n\nHelpful pytest fixtures for sphinx extensions.\n\nSphinx is annoying, because the modularity is not great,\nmeaning that there is no real way just to convert single documents in isolation, etc.\n\nThis extension mainly provides some pytest fixtures to \"simulate\" converting some source text to docutils AST at different stages; before transforms, after transforms, etc.\n\n\n## Installation\n\n```\npip install sphinx-pytest\n```\n\n## Examples\n\n```python\nfrom sphinx_pytest.plugin import CreateDoctree\n\ndef test_no_transforms(sphinx_doctree_no_tr: CreateDoctree):\n    \"\"\"Return the doctree, before any transforms have been applied.\"\"\"\n    sphinx_doctree_no_tr.set_conf({\"language\": \"en\"})\n    result = sphinx_doctree_no_transforms(\".. _target:\\n\\nheader\\n------\\n\")\n    assert (\n        result.pformat()\n        == \"\"\"\\\n<document source=\"<src>/index.rst\">\n    <target ids=\"target\" names=\"target\">\n    <section ids=\"header\" names=\"header\">\n        <title>\n            header\n\"\"\".rstrip()\n    )\n```\n\n```python\ndef test_with_transforms(sphinx_doctree: CreateDoctree):\n    \"\"\"Return the doctree, after transforms (but not post-transforms).\"\"\"\n    result = sphinx_doctree(\".. _target:\\n\\nheader\\n------\\n\")\n    assert (\n        result.pformat()\n        == \"\"\"\\\n<document source=\"<src>/index.rst\">\n    <target refid=\"target\">\n    <section ids=\"header target\" names=\"header target\">\n        <title>\n            header\n\"\"\".rstrip()\n    )\n```\n\n\n[pypi-badge]: https://img.shields.io/pypi/v/sphinx_pytest.svg\n[pypi-link]: https://pypi.org/project/sphinx_pytest\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Helpful pytest fixtures for sphinx extensions.",
    "version": "0.2.0",
    "project_urls": {
        "Homepage": "https://github.com/sphinx-extensions2/sphinx-pytest"
    },
    "split_keywords": [
        "sphinx",
        "pytest"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "b1bb4e8bf4554dc02d2f83cbd4ffb75e29673d746783d251280e9a54d0fa59dc",
                "md5": "98b35d7f8128eccb81f22845d45209b5",
                "sha256": "c64d68bf29af7a0432360d9e0624417e1c1378bbff53bd3229936b47ed8446fd"
            },
            "downloads": -1,
            "filename": "sphinx_pytest-0.2.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "98b35d7f8128eccb81f22845d45209b5",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 5608,
            "upload_time": "2023-09-20T10:32:00",
            "upload_time_iso_8601": "2023-09-20T10:32:00.755173Z",
            "url": "https://files.pythonhosted.org/packages/b1/bb/4e8bf4554dc02d2f83cbd4ffb75e29673d746783d251280e9a54d0fa59dc/sphinx_pytest-0.2.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "3e9dc83b6507b88f134a51fc97a952f627c327cf78189faaf857a93ef01ea1f8",
                "md5": "7cd66038ae92d0e5d523c38aca66782b",
                "sha256": "3c26f5c39ed8600eb4f554d07034f114952c101a011f7fcfeed72c28ffe12670"
            },
            "downloads": -1,
            "filename": "sphinx_pytest-0.2.0.tar.gz",
            "has_sig": false,
            "md5_digest": "7cd66038ae92d0e5d523c38aca66782b",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 7102,
            "upload_time": "2023-09-20T10:32:02",
            "upload_time_iso_8601": "2023-09-20T10:32:02.502638Z",
            "url": "https://files.pythonhosted.org/packages/3e/9d/c83b6507b88f134a51fc97a952f627c327cf78189faaf857a93ef01ea1f8/sphinx_pytest-0.2.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-09-20 10:32:02",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "sphinx-extensions2",
    "github_project": "sphinx-pytest",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "tox": true,
    "lcname": "sphinx_pytest"
}
        
Elapsed time: 0.11853s