Skip to content

Commit

Permalink
update import to work with django < 4.2
Browse files Browse the repository at this point in the history
trying to run tests with django versions < 4.2 threw an import error
since assertQuerySetEqual was named assertQuerysetEqual, with a
lowercase "s" in "set":

tests/test_webservices.py:12: in <module>
    from pytest_django.asserts import assertQuerySetEqual
E   ImportError: cannot import name 'assertQuerySetEqual' from 'pytest_django.asserts'

this swaps the right name in according to django's version.
  • Loading branch information
stefano-esubasta authored and WhyNotHugo committed May 10, 2024
1 parent 0929193 commit e307ddb
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
7 changes: 6 additions & 1 deletion tests/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,14 @@
from unittest.mock import patch

import pytest
from django import VERSION as DJANGO_VERSION
from django.db.models import DecimalField
from freezegun import freeze_time
from pytest_django.asserts import assertQuerySetEqual

if DJANGO_VERSION[0] < 5:
from pytest_django.asserts import assertQuerysetEqual as assertQuerySetEqual
else:
from pytest_django.asserts import assertQuerySetEqual

from django_afip import exceptions
from django_afip import factories
Expand Down
7 changes: 6 additions & 1 deletion tests/test_webservices.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,14 @@
from unittest.mock import patch

import pytest
from django import VERSION as DJANGO_VERSION
from django.core import management
from factory.django import FileField
from pytest_django.asserts import assertQuerySetEqual

if DJANGO_VERSION[0] < 5:
from pytest_django.asserts import assertQuerysetEqual as assertQuerySetEqual
else:
from pytest_django.asserts import assertQuerySetEqual

from django_afip import exceptions
from django_afip import factories
Expand Down

0 comments on commit e307ddb

Please sign in to comment.