From fa0a5766bcba895dca0dbad9c9220903ef7317b2 Mon Sep 17 00:00:00 2001 From: jinzhimin369 Date: Tue, 10 Nov 2020 21:21:59 +0800 Subject: [PATCH] fix the network tests failed --- python-dns.spec | 10 +++++++--- retry-network-availble.patch | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+), 3 deletions(-) create mode 100644 retry-network-availble.patch diff --git a/python-dns.spec b/python-dns.spec index 249faa5..de9230e 100644 --- a/python-dns.spec +++ b/python-dns.spec @@ -14,7 +14,7 @@ messages, names, and records. Name: python-dns Summary: %{sum} Version: 1.16.0 -Release: 1 +Release: 2 License: MIT URL: http://www.dnspython.org/ Source0: http://www.dnspython.org/kits/%{version}/dnspython-%{version}.tar.gz @@ -23,6 +23,7 @@ BuildArch: noarch Patch0: unicode_label_escapify.patch Patch1: collections_abc.patch Patch2: base64.patch +Patch3: retry-network-availble.patch BuildRequires: python3-devel python3-setuptools python3-pycryptodome python3-ecdsa @@ -61,11 +62,14 @@ find examples -type f | xargs chmod a-x %doc examples %changelog +* Tue Nov 10 2020 jinzhimin - 1.16.0-2 +- fix the network tests failed + * Tue Nov 10 2020 jinzhimin - 1.16.0-1 -* update to 1.16.0 +- update to 1.16.0 * Wed Oct 21 2020 jinzhimin - 1.15.0-11 -* remove python2-dns subpackage +- remove python2-dns subpackage * Fri Dec 6 2019 caomeng - 1.15.0-10 - Package init diff --git a/retry-network-availble.patch b/retry-network-availble.patch new file mode 100644 index 0000000..3d2ef31 --- /dev/null +++ b/retry-network-availble.patch @@ -0,0 +1,35 @@ +From 5e24db163fa5070bbb69f09473cf50436e5a323c Mon Sep 17 00:00:00 2001 +From: jinzhimin +Date: Tue, 10 Nov 2020 20:32:07 +0800 +Subject: [PATCH] retry-network-availble + +--- + tests/test_resolver.py | 12 ++++++++---- + 1 file changed, 8 insertions(+), 4 deletions(-) + +diff --git a/tests/test_resolver.py b/tests/test_resolver.py +index 1738c1a..b91ba0b 100644 +--- a/tests/test_resolver.py ++++ b/tests/test_resolver.py +@@ -32,10 +32,14 @@ from dns._compat import xrange, PY3 + # Some tests require the internet to be available to run, so let's + # skip those if it's not there. + _network_available = True +-try: +- socket.gethostbyname('dnspython.org') +-except socket.gaierror: +- _network_available = False ++count = 0 ++while count < 5 and _network_available: ++ try: ++ socket.gethostbyname('dnspython.org') ++ _network_available = True ++ except socket.gaierror: ++ _network_available = False ++ count += 1 + + resolv_conf = u""" + /t/t +-- +2.27.0 +