summaryrefslogtreecommitdiff
path: root/lib/dnspython/tests/resolver.py
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2010-12-09 14:53:45 +0100
committerJelmer Vernooij <jelmer@samba.org>2010-12-10 03:04:06 +0100
commit75ef8f1dd27f4985b3d705e7681a9218ad513c84 (patch)
treec28f415ff0e15bc40aa07f191afe0238d45ae598 /lib/dnspython/tests/resolver.py
parent91438920b465ec7455dd1cd700bbe8ec5050b3f9 (diff)
downloadsamba-75ef8f1dd27f4985b3d705e7681a9218ad513c84.tar.gz
samba-75ef8f1dd27f4985b3d705e7681a9218ad513c84.tar.bz2
samba-75ef8f1dd27f4985b3d705e7681a9218ad513c84.zip
dnspython: Update to newer upstream snapshot.
Diffstat (limited to 'lib/dnspython/tests/resolver.py')
-rw-r--r--lib/dnspython/tests/resolver.py24
1 files changed, 23 insertions, 1 deletions
diff --git a/lib/dnspython/tests/resolver.py b/lib/dnspython/tests/resolver.py
index 4cacbdc79d..bd6dc5fbc2 100644
--- a/lib/dnspython/tests/resolver.py
+++ b/lib/dnspython/tests/resolver.py
@@ -14,6 +14,7 @@
# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
import cStringIO
+import select
import sys
import time
import unittest
@@ -46,7 +47,7 @@ example. 1 IN A 10.0.0.1
;ADDITIONAL
"""
-class ResolverTestCase(unittest.TestCase):
+class BaseResolverTests(object):
if sys.platform != 'win32':
def testRead(self):
@@ -101,5 +102,26 @@ class ResolverTestCase(unittest.TestCase):
zname = dns.resolver.zone_for_name(name)
self.failUnlessRaises(dns.resolver.NotAbsolute, bad)
+class PollingMonkeyPatchMixin(object):
+ def setUp(self):
+ self.__native_polling_backend = dns.query._polling_backend
+ dns.query._set_polling_backend(self.polling_backend())
+
+ unittest.TestCase.setUp(self)
+
+ def tearDown(self):
+ dns.query._set_polling_backend(self.__native_polling_backend)
+
+ unittest.TestCase.tearDown(self)
+
+class SelectResolverTestCase(PollingMonkeyPatchMixin, BaseResolverTests, unittest.TestCase):
+ def polling_backend(self):
+ return dns.query._select_for
+
+if hasattr(select, 'poll'):
+ class PollResolverTestCase(PollingMonkeyPatchMixin, BaseResolverTests, unittest.TestCase):
+ def polling_backend(self):
+ return dns.query._poll_for
+
if __name__ == '__main__':
unittest.main()