Name | pytest-doctest-mkdocstring JSON |
Version |
0.0.3
JSON |
| download |
home_page | |
Summary | Run pytest --doctest-modules with markdown docstrings (code blocks) |
upload_time | 2024-02-25 21:32:09 |
maintainer | |
docs_url | None |
author | Mike Foster |
requires_python | >=3.7 |
license | |
keywords |
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# pytest-doctest-mkdocstring
A pytest plugin that allows you to use doctest and enclose your example code blocks in ` ``` ` codeblocks (e.g. when building documentation with mkdocs and mkdocstring).
Usually this docstring would fail doctest:
```
"""
A function description
Examples:
--------
```
>>> x = 1
>>> x
1
```
"""
```
As doctest looks for the output
```
Expected:
1
```
Got:
1
```
This plugin works by mockeypatching doctests parser when pytest begins each test session and including ` ``` ` as an identifier of the end of an expected result (a `want`).
It only works when doctest is invoked via pytest, not when invoking doctest directly
If you have code examples or expected results which actually contain ` ``` ` then you'll need to re-write them.
## Usage
1. **Strongly recommended** to set up a virtual environment first! (e.g.. `python3 -m venv .venv`, `. .venv/bin/activate`)
1. Install with `pip install pytest-doctest-mkdocstring`
1. Run pytest: `pytest --doctest-modules`
You can also add the following to your `pyproject.toml` so that pytest always runs doctests:
```
[tool.pytest.ini_options]
addopts = [
"--doctest-modules",
]
```
Raw data
{
"_id": null,
"home_page": "",
"name": "pytest-doctest-mkdocstring",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": "",
"keywords": "",
"author": "Mike Foster",
"author_email": "",
"download_url": "https://files.pythonhosted.org/packages/4a/a0/ad5b0b87ecaee634aba054eaf5fc0269bcd2995b7c59e002595a0b8fe38e/pytest-doctest-mkdocstring-0.0.3.tar.gz",
"platform": null,
"description": "# pytest-doctest-mkdocstring\n\nA pytest plugin that allows you to use doctest and enclose your example code blocks in ` ``` ` codeblocks (e.g. when building documentation with mkdocs and mkdocstring).\n\nUsually this docstring would fail doctest:\n\n```\n \"\"\"\n A function description\n\n Examples:\n --------\n ```\n >>> x = 1\n >>> x\n 1\n ```\n \"\"\"\n```\n\nAs doctest looks for the output\n```\nExpected:\n 1\n ```\nGot:\n 1\n```\n\nThis plugin works by mockeypatching doctests parser when pytest begins each test session and including ` ``` ` as an identifier of the end of an expected result (a `want`).\n\nIt only works when doctest is invoked via pytest, not when invoking doctest directly\n\nIf you have code examples or expected results which actually contain ` ``` ` then you'll need to re-write them.\n\n## Usage\n\n1. **Strongly recommended** to set up a virtual environment first! (e.g.. `python3 -m venv .venv`, `. .venv/bin/activate`)\n1. Install with `pip install pytest-doctest-mkdocstring`\n1. Run pytest: `pytest --doctest-modules`\n\nYou can also add the following to your `pyproject.toml` so that pytest always runs doctests:\n```\n[tool.pytest.ini_options]\naddopts = [\n \"--doctest-modules\",\n]\n```\n",
"bugtrack_url": null,
"license": "",
"summary": "Run pytest --doctest-modules with markdown docstrings (code blocks)",
"version": "0.0.3",
"project_urls": {
"Homepage": "https://github.com/MusicalNinjaDad/pytest-doctest-mkdocstring",
"Issues": "https://github.com/MusicalNinjaDad/pytest-doctest-mkdocstring/issues",
"Repository": "https://github.com/MusicalNinjaDad/pytest-doctest-mkdocstring"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "4f50286380fb03d7913b8c84ebae94dadc202b48476b69f86217dd43e07dfb8b",
"md5": "da8184c5ae4e0bcdfe828dd357570a8c",
"sha256": "b160d5335dbcacb9913292abf6966ef34e7af69ee20b6492e63b93094b26ffcd"
},
"downloads": -1,
"filename": "pytest_doctest_mkdocstring-0.0.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "da8184c5ae4e0bcdfe828dd357570a8c",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 3156,
"upload_time": "2024-02-25T21:32:07",
"upload_time_iso_8601": "2024-02-25T21:32:07.867027Z",
"url": "https://files.pythonhosted.org/packages/4f/50/286380fb03d7913b8c84ebae94dadc202b48476b69f86217dd43e07dfb8b/pytest_doctest_mkdocstring-0.0.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "4aa0ad5b0b87ecaee634aba054eaf5fc0269bcd2995b7c59e002595a0b8fe38e",
"md5": "f5b3e9650c1157cfc60b25992a8b3683",
"sha256": "0f418fee24e9b8b7aaa6bd0aa621d4d22490ef87e371d87cfd1ddf8165ba1e7c"
},
"downloads": -1,
"filename": "pytest-doctest-mkdocstring-0.0.3.tar.gz",
"has_sig": false,
"md5_digest": "f5b3e9650c1157cfc60b25992a8b3683",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 3381,
"upload_time": "2024-02-25T21:32:09",
"upload_time_iso_8601": "2024-02-25T21:32:09.340312Z",
"url": "https://files.pythonhosted.org/packages/4a/a0/ad5b0b87ecaee634aba054eaf5fc0269bcd2995b7c59e002595a0b8fe38e/pytest-doctest-mkdocstring-0.0.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-02-25 21:32:09",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "MusicalNinjaDad",
"github_project": "pytest-doctest-mkdocstring",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "pytest-doctest-mkdocstring"
}