Accepting request 1178915 from devel:languages:python

- update to 2.1.1:
  * Fixed typo 'marking' instead of 'marketing' in case-
    insensitive mailbox name list.
  * When DNS-based deliverability checks fail, in some cases
    exceptions are now thrown with `raise ... from` for better
    nested exception tracking.
  * Fixed tests to work when no local resolver can be configured.
  * This project is now licensed under the Unlicense (instead of
    CC0).
  * Minor improvements to tests.
  * Minor improvements to code style.
- drop dont-require-resolv-tests.patch: obsolete

  * Ignore warning as error from requests-toolbelt via dnspython.

OBS-URL: https://build.opensuse.org/request/show/1178915
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-email-validator?expand=0&rev=7
This commit is contained in:
Ana Guerrero 2024-06-07 13:02:11 +00:00 committed by Git OBS Bridge
commit a720363e70
5 changed files with 23 additions and 68 deletions

View File

@ -1,59 +0,0 @@
Index: python-email-validator-2.0.0/email_validator/deliverability.py
===================================================================
--- python-email-validator-2.0.0.orig/email_validator/deliverability.py
+++ python-email-validator-2.0.0/email_validator/deliverability.py
@@ -6,11 +6,11 @@ import dns.resolver
import dns.exception
-def caching_resolver(*, timeout: Optional[int] = None, cache=None):
+def caching_resolver(*, timeout: Optional[int] = None, cache=None, resolv=None):
if timeout is None:
from . import DEFAULT_TIMEOUT
timeout = DEFAULT_TIMEOUT
- resolver = dns.resolver.Resolver()
+ resolver = dns.resolver.Resolver(filename=resolv or '/etc/resolv.conf')
resolver.cache = cache or dns.resolver.LRUCache() # type: ignore
resolver.lifetime = timeout # type: ignore # timeout, in seconds
return resolver
Index: python-email-validator-2.0.0/tests/mocked_dns_response.py
===================================================================
--- python-email-validator-2.0.0.orig/tests/mocked_dns_response.py
+++ python-email-validator-2.0.0/tests/mocked_dns_response.py
@@ -1,5 +1,6 @@
import dns.resolver
import json
+import os
import os.path
import pytest
@@ -32,7 +33,8 @@ class MockedDnsResponseData:
# Return a new dns.resolver.Resolver configured for caching
# using the singleton instance.
- return caching_resolver(cache=MockedDnsResponseData.INSTANCE)
+ return caching_resolver(cache=MockedDnsResponseData.INSTANCE,
+ resolv=os.environ.get('RESOLV_FILE'))
def __init__(self):
self.data = {}
Index: python-email-validator-2.0.0/tests/test_deliverability.py
===================================================================
--- python-email-validator-2.0.0.orig/tests/test_deliverability.py
+++ python-email-validator-2.0.0/tests/test_deliverability.py
@@ -1,5 +1,6 @@
import pytest
import re
+import os
from email_validator import EmailUndeliverableError, \
validate_email, caching_resolver
@@ -73,7 +74,7 @@ def test_caching_dns_resolver():
self.cache[key] = value
cache = TestCache()
- resolver = caching_resolver(timeout=1, cache=cache)
+ resolver = caching_resolver(timeout=1, cache=cache, resolv=os.environ.get('RESOLV_FILE'))
validate_email("test@gmail.com", dns_resolver=resolver)
assert len(cache.cache) == 1

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:dd26943d2030b0d1fd73455a4365773d54c0daa47ba37b3cbab7aca18d465218
size 39752

View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:051fdaf98263be9afa52dcd50b6bc591708654b6b598b47e4a4080205a717fc1
size 38305

View File

@ -1,3 +1,19 @@
-------------------------------------------------------------------
Thu Jun 6 07:38:28 UTC 2024 - Dirk Müller <dmueller@suse.com>
- update to 2.1.1:
* Fixed typo 'marking' instead of 'marketing' in case-
insensitive mailbox name list.
* When DNS-based deliverability checks fail, in some cases
exceptions are now thrown with `raise ... from` for better
nested exception tracking.
* Fixed tests to work when no local resolver can be configured.
* This project is now licensed under the Unlicense (instead of
CC0).
* Minor improvements to tests.
* Minor improvements to code style.
- drop dont-require-resolv-tests.patch: obsolete
-------------------------------------------------------------------
Thu Nov 16 10:02:55 UTC 2023 - Dirk Müller <dmueller@suse.com>
@ -111,7 +127,7 @@ Thu Sep 8 07:24:18 UTC 2022 - Steve Kowalik <steven.kowalik@suse.com>
TEST_ENVIRONMENT, and DEFAULT_TIMEOUT can be used to change the default
values of the keyword arguments.
- Add patch ignore-urllib3-pyopenssl-warning.patch:
* Ignore warning as error from requests-toolbelt via dnspython.
* Ignore warning as error from requests-toolbelt via dnspython.
-------------------------------------------------------------------
Tue Apr 19 17:42:44 UTC 2022 - Matej Cepl <mcepl@suse.com>

View File

@ -1,7 +1,7 @@
#
# spec file for package python-email-validator
#
# Copyright (c) 2023 SUSE LLC
# Copyright (c) 2024 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@ -18,7 +18,7 @@
%{?sle15_python_module_pythons}
Name: python-email-validator
Version: 2.1.0
Version: 2.1.1
Release: 0
Summary: A robust email syntax and deliverability validation library for Python
License: CC0-1.0
@ -27,8 +27,6 @@ Source: https://github.com/JoshData/python-email-validator/archive/refs/
# PATCH-FIX-OPENSUSE Ignore DeprecationWarning until requests-toolbelt is fixed
# (Pulled in by dnspython)
Patch0: ignore-urllib3-pyopenssl-warning.patch
# PATCH-FIX-OPENSUSE do not require /etc/resolv.conf for testing
Patch1: dont-require-resolv-tests.patch
BuildRequires: %{python_module base >= 3.8}
BuildRequires: %{python_module dnspython >= 1.15.0}
BuildRequires: %{python_module idna >= 2.0.0}
@ -40,7 +38,7 @@ Requires: python-dnspython >= 1.15.0
Requires: python-idna >= 2.0.0
Requires: python-setuptools
Requires(post): update-alternatives
Requires(postun):update-alternatives
Requires(postun): update-alternatives
Provides: python-email_validator = %{version}-%{release}
Obsoletes: python-email_validator < %{version}-%{release}
BuildArch: noarch