From 95ef46be9b24190e18d3811ecec5fe251cb9c8f7 Mon Sep 17 00:00:00 2001 From: Alessio Bogon <778703+youtux@users.noreply.github.com> Date: Tue, 16 Sep 2025 21:53:13 +0200 Subject: [PATCH] Rename `fixtures` params to `dependencies` --- src/pytest_factoryboy/fixture.py | 10 +++++----- src/pytest_factoryboy/fixturegen.py | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/pytest_factoryboy/fixture.py b/src/pytest_factoryboy/fixture.py index d924c76..2b7b058 100644 --- a/src/pytest_factoryboy/fixture.py +++ b/src/pytest_factoryboy/fixture.py @@ -187,7 +187,7 @@ def generate_fixtures( create_fixture_with_related( name=model_name, function=functools.partial(model_fixture, factory_name=factory_name), - fixtures=deps, + dependencies=deps, related=related, ), ) @@ -196,12 +196,12 @@ def generate_fixtures( def create_fixture_with_related( name: str, function: Callable[P, T], - fixtures: Collection[str] | None = None, + dependencies: Collection[str] | None = None, related: Collection[str] | None = None, ) -> Callable[P, T]: if related is None: related = [] - fixture, fn = create_fixture(name=name, function=function, fixtures=fixtures) + fixture, fn = create_fixture(name=name, function=function, dependencies=dependencies) # We have to set the `_factoryboy_related` attribute to the original function, since # FixtureDef.func will provide that one later when we discover the related fixtures. @@ -234,7 +234,7 @@ def make_declaration_fixturedef( return create_fixture_with_related( name=attr_name, function=functools.partial(subfactory_fixture, factory_class=subfactory_class), - fixtures=args, + dependencies=args, ) deps: list[str] # makes mypy happy @@ -254,7 +254,7 @@ def make_declaration_fixturedef( return create_fixture_with_related( name=attr_name, function=functools.partial(attr_fixture, value=value), - fixtures=deps, + dependencies=deps, ) diff --git a/src/pytest_factoryboy/fixturegen.py b/src/pytest_factoryboy/fixturegen.py index cd9379b..732f2e5 100644 --- a/src/pytest_factoryboy/fixturegen.py +++ b/src/pytest_factoryboy/fixturegen.py @@ -17,13 +17,13 @@ def create_fixture( name: str, function: Callable[P, T], - fixtures: Collection[str] | None = None, + dependencies: Collection[str] | None = None, ) -> tuple[PytestFixtureT, Callable[P, T]]: """Dynamically create a pytest fixture. :param name: Name of the fixture. :param function: Function to be called. - :param fixtures: List of fixtures dependencies, but that will not be passed to ``function``. + :param dependencies: List of fixtures dependencies, but that will not be passed to ``function``. :return: The created fixture function and the actual function. Example: @@ -40,10 +40,10 @@ def create_fixture( def book(name, db): return Book(name=name) """ - if fixtures is None: - fixtures = [] + if dependencies is None: + dependencies = [] - @usefixtures(*fixtures) + @usefixtures(*dependencies) @functools.wraps(function) def fn(*args: P.args, **kwargs: P.kwargs) -> T: return function(*args, **kwargs)