Merge "Add config fixture support to unit tests"
diff --git a/.testr.conf b/.testr.conf
index abaf14a..4f6e0b3 100644
--- a/.testr.conf
+++ b/.testr.conf
@@ -2,6 +2,7 @@
test_command=OS_STDOUT_CAPTURE=${OS_STDOUT_CAPTURE:-1} \
OS_STDERR_CAPTURE=${OS_STDERR_CAPTURE:-1} \
OS_TEST_TIMEOUT=${OS_TEST_TIMEOUT:-500} \
+ OS_TEST_LOCK_PATH=${OS_TEST_LOCK_PATH:-${TMPDIR:-'/tmp'}} \
${PYTHON:-python} -m subunit.run discover -t ./ ${OS_TEST_PATH:-./tempest/test_discover} $LISTOPT $IDOPTION
test_id_option=--load-list $IDFILE
test_list_option=--list
diff --git a/tempest/tests/fake_config.py b/tempest/tests/fake_config.py
index 8a8ebb0..4676cbd 100644
--- a/tempest/tests/fake_config.py
+++ b/tempest/tests/fake_config.py
@@ -12,16 +12,21 @@
# License for the specific language governing permissions and limitations
# under the License.
+import os
+
from oslo.config import cfg
from tempest import config
from tempest.openstack.common.fixture import config as conf_fixture
+from tempest.openstack.common import importutils
class ConfigFixture(conf_fixture.Config):
def __init__(self):
config.register_opts()
+ # Register locking options
+ importutils.import_module('tempest.openstack.common.lockutils')
super(ConfigFixture, self).__init__()
def setUp(self):
@@ -36,6 +41,10 @@
group='identity')
self.conf.set_default('neutron', True, group='service_available')
self.conf.set_default('heat', True, group='service_available')
+ if not os.path.exists(str(os.environ.get('OS_TEST_LOCK_PATH'))):
+ os.mkdir(str(os.environ.get('OS_TEST_LOCK_PATH')))
+ self.conf.set_default('lock_path',
+ str(os.environ.get('OS_TEST_LOCK_PATH')))
class FakePrivate(config.TempestConfigPrivate):