Skip to content

Fix compat with pytest 5.x #751

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 29, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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