Skip to content

Display fixture name if different than function name #86

@devmonkey22

Description

@devmonkey22

Description

Can we add support to use the pytest.fixture name parameter, if defined? Currently, the fixture is displayed with the fixture's function name. However, as described by pytest:

Parameter name: This defaults to the name of the decorated function. If a fixture is used in the same module in which it is defined, the function name of the fixture will be shadowed by the function arg that requests the fixture; one way to resolve this is to name the decorated function fixture_ and then use @pytest.fixture(name='').

@pytest.fixture(name="myfixture", scope="session")
async def fixture_myfixture():
    ...

It could display the name either in the signature line, or at least if name is diff than the function name, display above Scope below the signature line?

Version

  • Operating System:
  • Python: 3.10
  • sphinx-autofixture: 0.4.1

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions