pytest-dev/pytest-django

RemovedInDjango51Warning: assertQuerysetEqual() is deprecated in favor of assertQuerySetEqual()

johnnymetz opened this issue · 1 comments

Background

In Django 4.2, assertQuerysetEqual() is deprecated in favor of assertQuerySetEqual(), see release notes: https://docs.djangoproject.com/en/4.2/releases/4.2/#id1

Steps to reproduce

from pytest_django.asserts import assertQuerysetEqual

assertQuerysetEqual(User.objects.all(), [user])
# django.utils.deprecation.RemovedInDjango51Warning: assertQuerysetEqual() is deprecated in favor of assertQuerySetEqual().

Notes

  • I have my test suite to error out on warnings so this is breaking my build.

The fix is to replace from pytest_django.asserts import assertQuerysetEqual with from pytest_django.asserts import assertQuerySetEqual - should work fine. If you're using mypy, the typing will be imprecise - will be fixed in the next release.