Skip to content

Commit

Permalink
Fix compat with pytest 5.x (#751)
Browse files Browse the repository at this point in the history
  • Loading branch information
rpkilby authored and blueyed committed Jun 29, 2019
1 parent 33aa666 commit 3d23d5a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions pytest_django/fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ def _django_db_fixture_helper(
if is_django_unittest(request):
return

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

Expand Down Expand Up @@ -187,11 +187,11 @@ def db(request, django_db_setup, django_db_blocker):
over each other in the following order (the last one wins): ``db``,
``transactional_db``, ``django_db_reset_sequences``.
"""
if "django_db_reset_sequences" in request.funcargnames:
if "django_db_reset_sequences" in request.fixturenames:
request.getfixturevalue("django_db_reset_sequences")
if (
"transactional_db" in request.funcargnames
or "live_server" in request.funcargnames
"transactional_db" in request.fixturenames
or "live_server" in request.fixturenames
):
request.getfixturevalue("transactional_db")
else:
Expand All @@ -212,7 +212,7 @@ def transactional_db(request, django_db_setup, django_db_blocker):
over each other in the following order (the last one wins): ``db``,
``transactional_db``, ``django_db_reset_sequences``.
"""
if "django_db_reset_sequences" in request.funcargnames:
if "django_db_reset_sequences" in request.fixturenames:
request.getfixturevalue("django_db_reset_sequences")
_django_db_fixture_helper(request, django_db_blocker, transactional=True)

Expand Down Expand Up @@ -410,7 +410,7 @@ def _live_server_helper(request):
It will also override settings only for the duration of the test.
"""
if "live_server" not in request.funcargnames:
if "live_server" not in request.fixturenames:
return

request.getfixturevalue("transactional_db")
Expand Down
2 changes: 1 addition & 1 deletion pytest_django/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@ def get_order_number(test):
else:
transaction = None

fixtures = getattr(test, 'funcargnames', [])
fixtures = getattr(test, 'fixturenames', [])
if "transactional_db" in fixtures:
return 1

Expand Down

0 comments on commit 3d23d5a

Please sign in to comment.