From c89e54cedc2a889b8e967be5b06a60d09ee1b81d Mon Sep 17 00:00:00 2001 From: Balazs Gibizer Date: Tue, 27 Jan 2026 14:46:29 +0100 Subject: [PATCH] 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 --- nova/test.py | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/nova/test.py b/nova/test.py index d785efed27..98c9978a11 100644 --- a/nova/test.py +++ b/nova/test.py @@ -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