Merge "Skip Redis specific tests when it is not installed"

This commit is contained in:
Jenkins 2015-10-08 22:26:21 +00:00 committed by Gerrit Code Review
commit 367e28b0f1

View File

@ -14,14 +14,31 @@
from stevedore import driver
import testscenarios
import testtools
import oslo_messaging
from oslo_messaging.tests import utils as test_utils
from oslo_utils import importutils
redis = importutils.try_import('redis')
def redis_available():
'''Helper to see if local redis server is running'''
if not redis:
return False
try:
c = redis.StrictRedis(socket_timeout=1)
c.ping()
return True
except redis.exceptions.ConnectionError:
return False
load_tests = testscenarios.load_tests_apply_scenarios
@testtools.skipIf(not redis_available(), "redis unavailable")
class TestImplMatchmaker(test_utils.BaseTestCase):
scenarios = [