core.fixtures.FixtureRegistry

core.fixtures.FixtureRegistry()

Registry for fixtures with dependency resolution.

Stores fixtures and their dependencies, provides topological sorting and resolution with caching.

Methods

Name Description
get_dependencies Get the dependencies of a fixture.
get_docstring Get the docstring of a fixture.
register Register a fixture.
resolve Resolve fixtures and their dependencies with caching.
topological_sort Sort fixture names by dependency order.

get_dependencies

core.fixtures.FixtureRegistry.get_dependencies(name)

Get the dependencies of a fixture.

Args: name: The fixture name

Returns: Set of fixture names this fixture depends on

get_docstring

core.fixtures.FixtureRegistry.get_docstring(name)

Get the docstring of a fixture.

Args: name: The fixture name

Returns: The docstring, or None if not set

register

core.fixtures.FixtureRegistry.register(name, func, dependencies, docstring=None)

Register a fixture.

Args: name: The fixture name func: The fixture function dependencies: Set of fixture names this fixture depends on docstring: Optional docstring for the fixture

resolve

core.fixtures.FixtureRegistry.resolve(names, initial=None)

Resolve fixtures and their dependencies with caching.

Args: names: List of fixture names to resolve initial: Optional dict of pre-resolved values

Returns: Dict mapping fixture names to their resolved values

topological_sort

core.fixtures.FixtureRegistry.topological_sort(names)

Sort fixture names by dependency order.

Uses Kahn’s algorithm to perform topological sorting. Fixtures with no dependencies come first.

Args: names: List of fixture names to sort

Returns: List of fixture names in dependency order

Raises: ValueError: If circular dependencies are detected