API Reference

Sphinx autodocumenter for pytest fixtures.

Classes:

FixtureDecoratorFinder()

ast.NodeVisitor for finding pytest fixtures.

FixtureDocumenter(directive, name[, indent])

Sphinx autodoc Documenter for documenting pytest fixtures.

Functions:

is_fixture(function)

Returns whether the given function is a fixture, and the fixture’s scope if it is.

setup(app)

Setup sphinx_autofixture.

class FixtureDecoratorFinder[source]

Bases: NodeVisitor

ast.NodeVisitor for finding pytest fixtures.

Attributes:

is_fixture

Is the function a fixture?

scope

If it is, the scope of the fixture.

is_fixture

Is the function a fixture?

scope

If it is, the scope of the fixture.

class FixtureDocumenter(directive, name, indent='')[source]

Bases: FunctionDocumenter

Sphinx autodoc Documenter for documenting pytest fixtures.

Methods:

add_directive_header([sig])

Add the directive’s header.

can_document_member(member, membername, …)

Called to see if a member can be documented by this documenter.

add_directive_header(sig='')[source]

Add the directive’s header.

Parameters

sig (str) – Unused – fixtures have no useful signature.

classmethod can_document_member(member, membername, isattr, parent)[source]

Called to see if a member can be documented by this documenter.

Parameters
  • member (Any) – The member being checked.

  • membername (str) – The name of the member.

  • isattr (bool)

  • parent (Any) – The parent of the member.

Return type

bool

is_fixture(function)[source]

Returns whether the given function is a fixture, and the fixture’s scope if it is.

Parameters

function (Union[FunctionType, MethodType])

Return type

Tuple[bool, Optional[str]]

setup(app)[source]

Setup sphinx_autofixture.

Parameters

app (Sphinx) – The Sphinx app.

Return type

Dict[str, Any]