#1 In the tests, only catch and assert warnings produced by django_auth_ldap
Merged 2 years ago by churchyard. Opened 2 years ago by churchyard.
rpms/ churchyard/python-django-auth-ldap tests_only_catch_our_warnings  into  rawhide

file modified
+7 -1
@@ -16,6 +16,12 @@ 

  URL:            https://pypi.org/project/django-auth-ldap

  Source:         %{pypi_source}

  

+ # In the tests, only catch and assert warnings produced by django_auth_ldap

+ # Needed for compatibility with Python 3.10+

+ # https://bugzilla.redhat.com/show_bug.cgi?id=1962238

+ # Not submitted upstream, the recent version 3.x removed the 2 affected tests

+ Patch1:         tests_only_catch_our_warnings.patch

+ 

  BuildArch:      noarch

  

  %description
@@ -38,7 +44,7 @@ 

  %{summary}.

  

  %prep

- %autosetup -n %{srcname}-%{version}

+ %autosetup -p1 -n %{srcname}-%{version}

  

  %build

  %py3_build

@@ -0,0 +1,24 @@ 

+ diff --git a/tests/tests.py b/tests/tests.py

+ index 7220f20..aaa583d 100644

+ --- a/tests/tests.py

+ +++ b/tests/tests.py

+ @@ -186,7 +186,8 @@ class LDAPTest(TestCase):

+          user_count = User.objects.count()

+  

+          with warnings.catch_warnings(record=True) as w:

+ -            warnings.simplefilter("always")

+ +            warnings.simplefilter("ignore")

+ +            warnings.filterwarnings("always", module="django_auth_ldap")

+              user = authenticate(username="alice", password="password")

+  

+          self.assertIs(user.has_usable_password(), False)

+ @@ -1572,7 +1573,8 @@ class LDAPTest(TestCase):

+              CACHE_GROUPS=True,

+          )

+          with warnings.catch_warnings(record=True) as w:

+ -            warnings.simplefilter("always")

+ +            warnings.simplefilter("ignore")

+ +            warnings.filterwarnings("always", module="django_auth_ldap")

+              user = authenticate(username="alice", password="password")

+          self.assertIsNotNone(user)

+          self.assertEqual(len(w), 1)