Skip to content

Commit 3d23d5a

Browse files
rpkilbyblueyed
authored andcommitted
Fix compat with pytest 5.x (#751)
1 parent 33aa666 commit 3d23d5a

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

pytest_django/fixtures.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ def _django_db_fixture_helper(
129129
if is_django_unittest(request):
130130
return
131131

132-
if not transactional and "live_server" in request.funcargnames:
132+
if not transactional and "live_server" in request.fixturenames:
133133
# Do nothing, we get called with transactional=True, too.
134134
return
135135

@@ -187,11 +187,11 @@ def db(request, django_db_setup, django_db_blocker):
187187
over each other in the following order (the last one wins): ``db``,
188188
``transactional_db``, ``django_db_reset_sequences``.
189189
"""
190-
if "django_db_reset_sequences" in request.funcargnames:
190+
if "django_db_reset_sequences" in request.fixturenames:
191191
request.getfixturevalue("django_db_reset_sequences")
192192
if (
193-
"transactional_db" in request.funcargnames
194-
or "live_server" in request.funcargnames
193+
"transactional_db" in request.fixturenames
194+
or "live_server" in request.fixturenames
195195
):
196196
request.getfixturevalue("transactional_db")
197197
else:
@@ -212,7 +212,7 @@ def transactional_db(request, django_db_setup, django_db_blocker):
212212
over each other in the following order (the last one wins): ``db``,
213213
``transactional_db``, ``django_db_reset_sequences``.
214214
"""
215-
if "django_db_reset_sequences" in request.funcargnames:
215+
if "django_db_reset_sequences" in request.fixturenames:
216216
request.getfixturevalue("django_db_reset_sequences")
217217
_django_db_fixture_helper(request, django_db_blocker, transactional=True)
218218

@@ -410,7 +410,7 @@ def _live_server_helper(request):
410410
411411
It will also override settings only for the duration of the test.
412412
"""
413-
if "live_server" not in request.funcargnames:
413+
if "live_server" not in request.fixturenames:
414414
return
415415

416416
request.getfixturevalue("transactional_db")

pytest_django/plugin.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -435,7 +435,7 @@ def get_order_number(test):
435435
else:
436436
transaction = None
437437

438-
fixtures = getattr(test, 'funcargnames', [])
438+
fixtures = getattr(test, 'fixturenames', [])
439439
if "transactional_db" in fixtures:
440440
return 1
441441

0 commit comments

Comments
 (0)