Skip to content

Commit 93fca47

Browse files
committed
fixup! Use Django's --keepdb with Django 1.8+
1 parent f13852a commit 93fca47

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

pytest_django/fixtures.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,14 @@ def _django_db_setup(request,
4444
_disable_native_migrations()
4545

4646
db_args = {}
47-
if (request.config.getvalue('reuse_db') and
48-
not request.config.getvalue('create_db')):
49-
if get_django_version() >= (1, 8):
50-
db_args['keepdb'] = True
51-
else:
52-
monkey_patch_creation_for_db_reuse()
53-
5447
with _django_cursor_wrapper:
48+
if (request.config.getvalue('reuse_db') and
49+
not request.config.getvalue('create_db')):
50+
if get_django_version() >= (1, 8):
51+
db_args['keepdb'] = True
52+
else:
53+
monkey_patch_creation_for_db_reuse()
54+
5555
# Create the database
5656
db_cfg = setup_databases(verbosity=pytest.config.option.verbose,
5757
interactive=False, **db_args)

0 commit comments

Comments
 (0)