Usage¶
Enable sphinx_autofixture
by adding the following
to the extensions
variable in your conf.py
:
extensions = [
...
'sphinx_autofixture',
]
For more information see https://www.sphinx-doc.org/en/master/usage/extensions#third-party-extensions .
-
.. autofixture::
¶ Directive to automatically document a pytest fixture.
Example:
@pytest.fixture() def tmp_pathplus(tmp_path: Path) -> PathPlus: """ Pytest fixture that returns a temporary directory in the form of a :class:`~domdf_python_tools.paths.PathPlus` object. The directory is unique to each test function invocation, created as a sub directory of the base temporary directory. Use it as follows: .. code-block:: python pytest_plugins = ("coincidence", ) def test_something(tmp_pathplus: PathPlus): assert True :rtype: .. versionadded:: 0.10.0 """ # noqa: D400 return PathPlus(tmp_path)
.. autofixture:: coincidence.tmp_pathplus
-
fixture
tmp_pathplus
[source]¶ Scope: function
Pytest fixture which returns a temporary directory in the form of a
PathPlus
object.The directory is unique to each test function invocation, created as a sub directory of the base temporary directory.
Use it as follows:
pytest_plugins = ("coincidence", ) def test_something(tmp_pathplus: PathPlus): assert True
- Return type
Tip
autofixture
can also be used withautomodule
.See also
The documentation for coincidence has an an example with the ReadTheDocs Sphinx theme.
-
fixture
-
:fixture:
¶ Role that provides a cross-reference to the documentation generated by
autofixture
.