added SkipTest for cname tests if dnspython is not installed

This commit is contained in:
John Dickinson
2010-11-04 16:31:20 -05:00
parent 10d4609c17
commit d122e5e98f
2 changed files with 11 additions and 4 deletions

View File

@@ -14,11 +14,16 @@
# limitations under the License. # limitations under the License.
import unittest import unittest
from nose import SkipTest
from webob import Request from webob import Request
try:
# this test requires the dnspython package to be installed
from swift.common.middleware import cname_lookup from swift.common.middleware import cname_lookup
skip = False
except ImportError:
skip = True
class FakeApp(object): class FakeApp(object):
@@ -33,6 +38,8 @@ def start_response(*args):
class TestCNAMELookup(unittest.TestCase): class TestCNAMELookup(unittest.TestCase):
def setUp(self): def setUp(self):
if skip:
raise SkipTest
self.app = cname_lookup.CNAMELookupMiddleware(FakeApp(), self.app = cname_lookup.CNAMELookupMiddleware(FakeApp(),
{'lookup_depth': 2}) {'lookup_depth': 2})