diff options
author | Jenkins <jenkins@review.openstack.org> | 2014-12-18 19:36:36 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2014-12-18 19:36:36 +0000 |
commit | cc4ec10d57e1bcbe4789a1b1cda86a2dfd327cdd (patch) | |
tree | 0274d9a8bef651104bc957bf4040b9e5c16febd9 | |
parent | 1e778dbfb84bf870d7b82ab6c408dd7630e29625 (diff) | |
parent | 39c09eda6033556072f80701afa1e6d720e366ca (diff) | |
download | tooz-cc4ec10d57e1bcbe4789a1b1cda86a2dfd327cdd.tar.gz |
Merge "tests: use scenarios attributes for timeout capability"
-rw-r--r-- | tooz/tests/test_coordination.py | 26 |
1 files changed, 6 insertions, 20 deletions
diff --git a/tooz/tests/test_coordination.py b/tooz/tests/test_coordination.py index 25083d2..c118821 100644 --- a/tooz/tests/test_coordination.py +++ b/tooz/tests/test_coordination.py @@ -33,23 +33,18 @@ class TestAPI(testscenarios.TestWithScenarios, 'bad_url': 'kazoo://localhost:1'}), ('zake', {'url': 'zake://?timeout=5'}), ('memcached', {'url': os.getenv("TOOZ_TEST_MEMCACHED_URL"), - 'bad_url': 'memcached://localhost:1'}), + 'bad_url': 'memcached://localhost:1', + 'timeout_capable': True}), ('ipc', {'url': 'ipc://'}), ('redis', {'url': os.getenv("TOOZ_TEST_REDIS_URL"), - 'bad_url': 'redis://localhost:1'}), + 'bad_url': 'redis://localhost:1', + 'timeout_capable': True}), ('postgresql', {'url': os.getenv("TOOZ_TEST_PGSQL_URL"), 'bad_url': 'postgresql://localhost:1'}), ('mysql', {'url': os.getenv("TOOZ_TEST_MYSQL_URL"), 'bad_url': 'mysql://localhost:1'}), ] - # Only certain drivers have the tested support for timeouts that we test - # here, these are the lists of driver types that do support our test type. - timeout_capable = [ - 'memcached://', - 'redis://', - ] - def assertRaisesAny(self, exc_classes, callable_obj, *args, **kwargs): checkers = [matchers.MatchesException(exc_class) for exc_class in exc_classes] @@ -57,16 +52,6 @@ class TestAPI(testscenarios.TestWithScenarios, callable_obj = testcase.Nullary(callable_obj, *args, **kwargs) self.assertThat(callable_obj, matcher) - def skipIfNotSupported(self, supported): - applicable = False - for prefix in supported: - if self.url.startswith(prefix): - applicable = True - break - if not applicable: - self.skipTest("This test only works with %s types for now" - % list(supported)) - def setUp(self): super(TestAPI, self).setUp() if self.url is None: @@ -270,7 +255,8 @@ class TestAPI(testscenarios.TestWithScenarios, self.assertTrue(member_id_test2 not in members_ids) def test_timeout(self): - self.skipIfNotSupported(self.timeout_capable) + if not getattr(self, "timeout_capable", False): + self.skipTest("This test only works with timeout capable drivers") member_id_test2 = self._get_random_uuid() client2 = tooz.coordination.get_coordinator(self.url, member_id_test2) |