@@ -94,22 +94,26 @@ def django_db_modify_db_settings_parallel_suffix(
94
94
def django_db_modify_db_settings (
95
95
django_db_modify_db_settings_parallel_suffix : None ,
96
96
) -> None :
97
+ """Modify db settings just before the databases are configured."""
97
98
skip_if_no_django ()
98
99
99
100
100
101
@pytest .fixture (scope = "session" )
101
102
def django_db_use_migrations (request : pytest .FixtureRequest ) -> bool :
103
+ """Return whether to use migrations to create the test databases."""
102
104
return not request .config .getvalue ("nomigrations" )
103
105
104
106
105
107
@pytest .fixture (scope = "session" )
106
108
def django_db_keepdb (request : pytest .FixtureRequest ) -> bool :
109
+ """Return whether to re-use an existing database and to keep it after the test run."""
107
110
reuse_db : bool = request .config .getvalue ("reuse_db" )
108
111
return reuse_db
109
112
110
113
111
114
@pytest .fixture (scope = "session" )
112
115
def django_db_createdb (request : pytest .FixtureRequest ) -> bool :
116
+ """Return whether the database is to be re-created before running any tests."""
113
117
create_db : bool = request .config .getvalue ("create_db" )
114
118
return create_db
115
119
@@ -656,11 +660,13 @@ def _assert_num_queries(
656
660
657
661
@pytest .fixture ()
658
662
def django_assert_num_queries (pytestconfig : pytest .Config ) -> DjangoAssertNumQueries :
663
+ """Allows to check for an expected number of DB queries."""
659
664
return partial (_assert_num_queries , pytestconfig )
660
665
661
666
662
667
@pytest .fixture ()
663
668
def django_assert_max_num_queries (pytestconfig : pytest .Config ) -> DjangoAssertNumQueries :
669
+ """Allows to check for an expected maximum number of DB queries."""
664
670
return partial (_assert_num_queries , pytestconfig , exact = False )
665
671
666
672
@@ -678,6 +684,7 @@ def __call__(
678
684
679
685
@pytest .fixture ()
680
686
def django_capture_on_commit_callbacks () -> DjangoCaptureOnCommitCallbacks :
687
+ """Captures transaction.on_commit() callbacks for the given database connection."""
681
688
from django .test import TestCase
682
689
683
690
return TestCase .captureOnCommitCallbacks # type: ignore[no-any-return]
0 commit comments