Skip to content

Commit 3f44e50

Browse files
committed
fixtures: avoid unnecessary closure
1 parent b732869 commit 3f44e50

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

pytest_django/fixtures.py

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,17 @@ def tearDownClass(cls) -> None:
256256
PytestDjangoTestCase.doClassCleanups()
257257

258258

259+
def _django_db_signature(
260+
transaction: bool = False,
261+
reset_sequences: bool = False,
262+
databases: _DjangoDbDatabases = None,
263+
serialized_rollback: bool = False,
264+
available_apps: _DjangoDbAvailableApps = None,
265+
) -> _DjangoDb:
266+
"""The signature of the django_db marker. Used by validate_django_db."""
267+
return transaction, reset_sequences, databases, serialized_rollback, available_apps
268+
269+
259270
def validate_django_db(marker: pytest.Mark) -> _DjangoDb:
260271
"""Validate the django_db marker.
261272
@@ -267,17 +278,7 @@ def validate_django_db(marker: pytest.Mark) -> _DjangoDb:
267278
Sequence reset, serialized_rollback, and available_apps are only allowed
268279
when combined with transaction.
269280
"""
270-
271-
def apifun(
272-
transaction: bool = False,
273-
reset_sequences: bool = False,
274-
databases: _DjangoDbDatabases = None,
275-
serialized_rollback: bool = False,
276-
available_apps: _DjangoDbAvailableApps = None,
277-
) -> _DjangoDb:
278-
return transaction, reset_sequences, databases, serialized_rollback, available_apps
279-
280-
return apifun(*marker.args, **marker.kwargs)
281+
return _django_db_signature(*marker.args, **marker.kwargs)
281282

282283

283284
def _disable_migrations() -> None:

0 commit comments

Comments
 (0)