[Python-modules-commits] [dnspython] 02/06: Only run tests in tests/test_resolver.py that require an Internet connection when it is available
Scott Kitterman
kitterman at moszumanska.debian.org
Sat May 28 17:27:22 UTC 2016
This is an automated email from the git hooks/post-receive script.
kitterman pushed a commit to branch master
in repository dnspython.
commit 742878da7ea7dc02bd127f9254aeb13d7d32a431
Author: Scott Kitterman <scott at kitterman.com>
Date: Sat May 28 02:56:55 2016 -0400
Only run tests in tests/test_resolver.py that require an Internet connection when it is available
---
tests/test_resolver.py | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/tests/test_resolver.py b/tests/test_resolver.py
index 29c3959..eb4f23e 100644
--- a/tests/test_resolver.py
+++ b/tests/test_resolver.py
@@ -16,6 +16,7 @@
from io import StringIO
import select
import sys
+import socket
import time
try:
import unittest2 as unittest
@@ -30,6 +31,14 @@ import dns.rdatatype
import dns.resolver
from dns._compat import xrange
+# 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
+
resolv_conf = u"""
/t/t
# comment 1
@@ -86,18 +95,21 @@ class BaseResolverTests(object):
self.failUnless(cache.get((name, dns.rdatatype.A, dns.rdataclass.IN))
is None)
+ @unittest.skipIf(not _network_available,"Internet not reachable")
def testZoneForName1(self):
name = dns.name.from_text('www.dnspython.org.')
ezname = dns.name.from_text('dnspython.org.')
zname = dns.resolver.zone_for_name(name)
self.failUnless(zname == ezname)
+ @unittest.skipIf(not _network_available,"Internet not reachable")
def testZoneForName2(self):
name = dns.name.from_text('a.b.www.dnspython.org.')
ezname = dns.name.from_text('dnspython.org.')
zname = dns.resolver.zone_for_name(name)
self.failUnless(zname == ezname)
+ @unittest.skipIf(not _network_available,"Internet not reachable")
def testZoneForName3(self):
name = dns.name.from_text('dnspython.org.')
ezname = dns.name.from_text('dnspython.org.')
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/dnspython.git
More information about the Python-modules-commits
mailing list