tests: remove testscenario usage

There's no need to use testscenarios since we use a different tox target for
each test class.

Change-Id: Id34b4fa938760c131600c80a4c28cd4aad3cca41
This commit is contained in:
Julien Danjou 2016-06-01 10:21:56 +02:00
parent 2ec9044211
commit 040464edec
2 changed files with 15 additions and 18 deletions

View File

@ -13,7 +13,6 @@ oslosphinx!=3.4.0,>=2.5.0 # Apache-2.0
python-subunit>=0.0.18 # Apache-2.0/BSD python-subunit>=0.0.18 # Apache-2.0/BSD
testrepository>=0.0.18 # Apache-2.0/BSD testrepository>=0.0.18 # Apache-2.0/BSD
testtools>=1.4.0 # MIT testtools>=1.4.0 # MIT
testscenarios>=0.4 # Apache-2.0/BSD
coverage>=3.6 # Apache-2.0 coverage>=3.6 # Apache-2.0
fixtures>=3.0.0 # Apache-2.0/BSD fixtures>=3.0.0 # Apache-2.0/BSD
pifpaf>=0.4.0 # Apache-2.0 pifpaf>=0.4.0 # Apache-2.0

View File

@ -23,7 +23,6 @@ from concurrent import futures
import fixtures import fixtures
import mock import mock
from six.moves.urllib import parse from six.moves.urllib import parse
import testscenarios
from testtools import matchers from testtools import matchers
from testtools import testcase from testtools import testcase
@ -40,22 +39,9 @@ def try_to_lock_job(name, coord, url, member_id):
return lock2.acquire(blocking=False) return lock2.acquire(blocking=False)
class TestAPI(testscenarios.TestWithScenarios, class TestAPI(tests.TestCaseSkipNotImplemented):
tests.TestCaseSkipNotImplemented):
scenarios = [ url = os.getenv("TOOZ_TEST_URL")
('kazoo', {'url': os.getenv("TOOZ_TEST_ZOOKEEPER_URL")}),
('zake', {'url': 'zake://?timeout=5'}),
('memcached', {'url': os.getenv("TOOZ_TEST_MEMCACHED_URL")}),
('ipc', {'url': 'ipc://'}),
('file', {'url': 'file:///tmp'}),
('redis', {'url': os.getenv("TOOZ_TEST_REDIS_URL")}),
('postgresql', {'url': os.getenv("TOOZ_TEST_POSTGRESQL_URL")}),
('mysql', {'url': os.getenv("TOOZ_TEST_MYSQL_URL")}),
('zookeeper', {'url': os.getenv("TOOZ_TEST_ZOOKEEPER_URL")}),
('etcd', {'url': os.getenv("TOOZ_TEST_ETCD_URL")}),
('consul', {'url': os.getenv("TOOZ_TEST_CONSUL_URL")}),
]
def assertRaisesAny(self, exc_classes, callable_obj, *args, **kwargs): def assertRaisesAny(self, exc_classes, callable_obj, *args, **kwargs):
checkers = [matchers.MatchesException(exc_class) checkers = [matchers.MatchesException(exc_class)
@ -66,9 +52,9 @@ class TestAPI(testscenarios.TestWithScenarios,
def setUp(self): def setUp(self):
super(TestAPI, self).setUp() super(TestAPI, self).setUp()
self.useFixture(fixtures.NestedTempfile())
if self.url is None: if self.url is None:
self.skipTest("No URL set for this driver") self.skipTest("No URL set for this driver")
self.useFixture(fixtures.NestedTempfile())
self.group_id = self._get_random_uuid() self.group_id = self._get_random_uuid()
self.member_id = self._get_random_uuid() self.member_id = self._get_random_uuid()
self._coord = tooz.coordination.get_coordinator(self.url, self._coord = tooz.coordination.get_coordinator(self.url,
@ -919,6 +905,18 @@ class TestAPI(testscenarios.TestWithScenarios,
self.assertTrue(lock.release()) self.assertTrue(lock.release())
class ZakeTestAPI(TestAPI):
url = "zake://"
class IPCTestAPI(TestAPI):
url = "ipc://"
class FileTestAPI(TestAPI):
url = "file:///tmp"
class TestHook(testcase.TestCase): class TestHook(testcase.TestCase):
def setUp(self): def setUp(self):
super(TestHook, self).setUp() super(TestHook, self).setUp()