Ensure package-wide test init is done with testr
This patch adds testresources.ResourcedTestCase as another base class
for compute and boto tests. This allows us to perform package-wide
init for tests when running them under testr. The init was not being
performed when the tests were run under testr because setup_package is
a nosetests specific init feature. The setup_package functions in
__init__.py files are renamed to ensure that the initialisation is
only done once.
Implements: blueprint speed-up-tempest
Change-Id: If76f71cb06f2243607db2680504e94dc65e1f585
diff --git a/tempest/tests/compute/__init__.py b/tempest/tests/compute/__init__.py
index 190cb5f..a00ec77 100644
--- a/tempest/tests/compute/__init__.py
+++ b/tempest/tests/compute/__init__.py
@@ -37,7 +37,7 @@
# All compute tests -- single setup function
-def setup_package():
+def generic_setup_package():
LOG.debug("Entering tempest.tests.compute.setup_package")
global MULTI_USER, DISK_CONFIG_ENABLED, FLAVOR_EXTRA_DATA_ENABLED
diff --git a/tempest/tests/compute/base.py b/tempest/tests/compute/base.py
index ae7c5ab..3f3b3e8 100644
--- a/tempest/tests/compute/base.py
+++ b/tempest/tests/compute/base.py
@@ -19,12 +19,14 @@
import time
import nose
+import testresources
import unittest2 as unittest
from tempest import clients
from tempest.common.utils.data_utils import rand_name
from tempest import config
from tempest import exceptions
+from tempest.tests import compute
__all__ = ['BaseComputeTest', 'BaseComputeTestJSON', 'BaseComputeTestXML',
'BaseComputeAdminTestJSON', 'BaseComputeAdminTestXML']
@@ -32,10 +34,13 @@
LOG = logging.getLogger(__name__)
-class BaseCompTest(unittest.TestCase):
+class BaseCompTest(unittest.TestCase,
+ testresources.ResourcedTestCase):
"""Base test case class for all Compute API tests."""
+ resources = [('compute_init', compute.generic_setup_package())]
+
@classmethod
def setUpClass(cls):
cls.config = config.TempestConfig()