python-dns/0001-Skip-tests-that-require-external-network-connection_rhbz#1914296.patch

106 lines
3.2 KiB
Diff

From 0414551fab97825fb826882b9c23c1a3ea0b71ea Mon Sep 17 00:00:00 2001
From: Rafael Guterres Jeffman <rjeffman@redhat.com>
Date: Thu, 22 Apr 2021 10:08:41 -0300
Subject: [PATCH] Skip tests that require external network connection.
---
tests/test_async.py | 11 ++---------
tests/test_query.py | 9 ++-------
tests/test_resolver.py | 10 ++--------
tests/test_resolver_override.py | 9 ++-------
4 files changed, 8 insertions(+), 31 deletions(-)
diff --git a/tests/test_async.py b/tests/test_async.py
index 0252f22..370c6bb 100644
--- a/tests/test_async.py
+++ b/tests/test_async.py
@@ -38,15 +38,8 @@ try:
except Exception:
_ssl_available = False
-
-# 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
-
+# RHEL 9 build environment does not have provide external network access.
+_network_available = False
# Probe for IPv4 and IPv6
query_addresses = []
diff --git a/tests/test_query.py b/tests/test_query.py
index 2cff377..99dc873 100644
--- a/tests/test_query.py
+++ b/tests/test_query.py
@@ -36,13 +36,8 @@ import dns.query
import dns.tsigkeyring
import dns.zone
-# 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
+# RHEL 9 build environment does not have provide external network access.
+_network_available = False
# Some tests use a "nano nameserver" for testing. It requires trio
# and threading, so try to import it and if it doesn't work, skip
diff --git a/tests/test_resolver.py b/tests/test_resolver.py
index 4f5643d..b26ab65 100644
--- a/tests/test_resolver.py
+++ b/tests/test_resolver.py
@@ -18,7 +18,6 @@
from io import StringIO
import selectors
import sys
-import socket
import time
import unittest
@@ -31,13 +30,8 @@ import dns.resolver
import dns.tsig
import dns.tsigkeyring
-# 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
+# RHEL 9 build environment does not have provide external network access.
+_network_available = False
# Some tests use a "nano nameserver" for testing. It requires trio
# and threading, so try to import it and if it doesn't work, skip
diff --git a/tests/test_resolver_override.py b/tests/test_resolver_override.py
index ac93316..036a42e 100644
--- a/tests/test_resolver_override.py
+++ b/tests/test_resolver_override.py
@@ -9,13 +9,8 @@ import dns.rdataclass
import dns.rdatatype
import dns.resolver
-# 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
+# RHEL 9 build environment does not have provide external network access.
+_network_available = False
@unittest.skipIf(not _network_available, "Internet not reachable")
--
2.30.2