SubclassSignatureTestCase to use NoDBTestCase as base
We have a list of fixtures included in the test.TestCase base class that prevents global data and tread leaking across test cases within the same process. The SubclassSignatureTestCase did not use our base class but it initializes a partial libvirt driver class that will soon use a ThreadPoolExecutor in native threading mode. So we need the leak protection here as well. So this patch moves SubclassSignatureTestCase to use the NoDBTestCase base class. Change-Id: I05e818e8e83757185e5af78a5a4771c90d9fa217 Signed-off-by: Balazs Gibizer <gibi@redhat.com>
This commit is contained in:
+10
-12
@@ -740,7 +740,15 @@ class APICoverage(object):
|
||||
testtools.matchers.ContainsAll(api_methods))
|
||||
|
||||
|
||||
class SubclassSignatureTestCase(testtools.TestCase, metaclass=abc.ABCMeta):
|
||||
class NoDBTestCase(TestCase):
|
||||
"""`NoDBTestCase` differs from TestCase in that DB access is not supported.
|
||||
This makes tests run significantly faster. If possible, all new tests
|
||||
should derive from this class.
|
||||
"""
|
||||
USES_DB = False
|
||||
|
||||
|
||||
class SubclassSignatureTestCase(NoDBTestCase, metaclass=abc.ABCMeta):
|
||||
"""Ensure all overridden methods of all subclasses of the class
|
||||
under test exactly match the signature of the base class.
|
||||
|
||||
@@ -759,10 +767,8 @@ class SubclassSignatureTestCase(testtools.TestCase, metaclass=abc.ABCMeta):
|
||||
raise NotImplementedError()
|
||||
|
||||
def setUp(self):
|
||||
self.useFixture(nova_fixtures.ConfFixture(CONF))
|
||||
self.base = self._get_base_class()
|
||||
|
||||
super(SubclassSignatureTestCase, self).setUp()
|
||||
self.base = self._get_base_class()
|
||||
|
||||
@staticmethod
|
||||
def _get_argspecs(cls):
|
||||
@@ -841,14 +847,6 @@ class TimeOverride(fixtures.Fixture):
|
||||
self.addCleanup(timeutils.clear_time_override)
|
||||
|
||||
|
||||
class NoDBTestCase(TestCase):
|
||||
"""`NoDBTestCase` differs from TestCase in that DB access is not supported.
|
||||
This makes tests run significantly faster. If possible, all new tests
|
||||
should derive from this class.
|
||||
"""
|
||||
USES_DB = False
|
||||
|
||||
|
||||
class MatchType(object):
|
||||
"""Matches any instance of a specified type
|
||||
|
||||
|
||||
Reference in New Issue
Block a user