Skip to content

Commit fcdb2c4

Browse files
committed
potential fix for database not being kept when both --reuse-db and --create-db are used
1 parent be209d6 commit fcdb2c4

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

pytest_django/fixtures.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ def django_db_setup(
104104
if not django_db_use_migrations:
105105
_disable_native_migrations()
106106

107-
if django_db_keepdb and not django_db_createdb:
107+
if django_db_keepdb:
108108
setup_databases_args["keepdb"] = True
109109

110110
with _django_db_blocker.unblock():

tests/test_db_setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ def test_d(settings, worker_id):
207207
result.stdout.fnmatch_lines(["*PASSED*test_d*"])
208208

209209
result = django_testdir.runpytest_subprocess(
210-
"-vv", "-n2", "-s", "--create-db"
210+
"-vv", "-n2", "-s", "--reuse-db", "--create-db"
211211
)
212212
assert result.ret == 0
213213
result.stdout.fnmatch_lines(["*PASSED*test_a*"])

0 commit comments

Comments
 (0)