From: Ben Darnell Date: Sat, 2 Mar 2013 19:00:53 +0000 (-0500) Subject: Test twisted and cares resolvers in netutil_test. X-Git-Tag: v3.0.0~86 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b0212d5489b10956976365c862470e338c45509a;p=thirdparty%2Ftornado.git Test twisted and cares resolvers in netutil_test. --- diff --git a/tornado/test/netutil_test.py b/tornado/test/netutil_test.py index b31e19519..6d9a63c16 100644 --- a/tornado/test/netutil_test.py +++ b/tornado/test/netutil_test.py @@ -11,6 +11,19 @@ try: except ImportError: futures = None +try: + import pycares +except ImportError: + pycares = None +else: + from tornado.platform.caresresolver import CaresResolver + +try: + import twisted +except ImportError: + twisted = None +else: + from tornado.platform.twisted import TwistedResolver class _ResolverTestMixin(object): def test_localhost(self): @@ -44,6 +57,20 @@ class ThreadedResolverTest(AsyncTestCase, _ResolverTestMixin): super(ThreadedResolverTest, self).tearDown() +@unittest.skipIf(pycares is None, "pycares module not present") +class CaresResolverTest(AsyncTestCase, _ResolverTestMixin): + def setUp(self): + super(CaresResolverTest, self).setUp() + self.resolver = CaresResolver(io_loop=self.io_loop) + + +@unittest.skipIf(twisted is None, "twisted module not present") +class TwistedResolverTest(AsyncTestCase, _ResolverTestMixin): + def setUp(self): + super(TwistedResolverTest, self).setUp() + self.resolver = TwistedResolver(io_loop=self.io_loop) + + class IsValidIPTest(unittest.TestCase): def test_is_valid_ip(self): self.assertTrue(is_valid_ip('127.0.0.1'))