Use oslotest instead of common test module

Module openstack.common.test is obsolete, so we should use
oslotest library instead of it.
Modified tests and common database code, new requirement added.

Change-Id: I853e548f11a4c3785eaf75124510a6d789536634
This commit is contained in:
Victor Sergeyev
2014-04-15 13:05:35 +03:00
committed by Ilya Pekelny
parent 2bcb32efbc
commit b13d73acb4
2 changed files with 11 additions and 11 deletions

View File

@@ -26,15 +26,15 @@ import eventlet
from eventlet import greenpool from eventlet import greenpool
from eventlet import greenthread from eventlet import greenthread
from oslo.config import cfg from oslo.config import cfg
from oslotest import base as test_base
from six import moves from six import moves
from openstack.common.fixture import config from openstack.common.fixture import config
from openstack.common.fixture import lockutils as fixtures from openstack.common.fixture import lockutils as fixtures
from openstack.common import lockutils from openstack.common import lockutils
from openstack.common import test
class TestFileLocks(test.BaseTestCase): class TestFileLocks(test_base.BaseTestCase):
def test_concurrent_green_lock_succeeds(self): def test_concurrent_green_lock_succeeds(self):
"""Verify spawn_n greenthreads with two locks run concurrently.""" """Verify spawn_n greenthreads with two locks run concurrently."""
@@ -70,7 +70,7 @@ class TestFileLocks(test.BaseTestCase):
shutil.rmtree(tmpdir) shutil.rmtree(tmpdir)
class LockTestCase(test.BaseTestCase): class LockTestCase(test_base.BaseTestCase):
def setUp(self): def setUp(self):
super(LockTestCase, self).setUp() super(LockTestCase, self).setUp()
@@ -373,7 +373,7 @@ class BrokenLock(lockutils._FileLock):
raise err raise err
class FileBasedLockingTestCase(test.BaseTestCase): class FileBasedLockingTestCase(test_base.BaseTestCase):
def setUp(self): def setUp(self):
super(FileBasedLockingTestCase, self).setUp() super(FileBasedLockingTestCase, self).setUp()
self.lock_dir = tempfile.mkdtemp() self.lock_dir = tempfile.mkdtemp()
@@ -460,7 +460,7 @@ class FileBasedLockingTestCase(test.BaseTestCase):
self.assertEqual(call_list, ['other', 'other', 'main', 'main']) self.assertEqual(call_list, ['other', 'other', 'main', 'main'])
class LockutilsModuleTestCase(test.BaseTestCase): class LockutilsModuleTestCase(test_base.BaseTestCase):
def setUp(self): def setUp(self):
super(LockutilsModuleTestCase, self).setUp() super(LockutilsModuleTestCase, self).setUp()
@@ -494,7 +494,7 @@ class LockutilsModuleTestCase(test.BaseTestCase):
self.assertEqual(retval, 0, "Bad OSLO_LOCK_PATH has been set") self.assertEqual(retval, 0, "Bad OSLO_LOCK_PATH has been set")
class TestLockFixture(test.BaseTestCase): class TestLockFixture(test_base.BaseTestCase):
def setUp(self): def setUp(self):
super(TestLockFixture, self).setUp() super(TestLockFixture, self).setUp()

View File

@@ -20,13 +20,13 @@ import os
import tempfile import tempfile
import fixtures import fixtures
from oslotest import base as test_base
import six import six
from openstack.common import processutils from openstack.common import processutils
from openstack.common import test
class UtilsTest(test.BaseTestCase): class UtilsTest(test_base.BaseTestCase):
# NOTE(jkoelker) Moar tests from nova need to be ported. But they # NOTE(jkoelker) Moar tests from nova need to be ported. But they
# need to be mock'd out. Currently they requre actually # need to be mock'd out. Currently they requre actually
# running code. # running code.
@@ -36,7 +36,7 @@ class UtilsTest(test.BaseTestCase):
hozer=True) hozer=True)
class ProcessExecutionErrorTest(test.BaseTestCase): class ProcessExecutionErrorTest(test_base.BaseTestCase):
def test_defaults(self): def test_defaults(self):
err = processutils.ProcessExecutionError() err = processutils.ProcessExecutionError()
@@ -211,7 +211,7 @@ def fake_execute_raises(*cmd, **kwargs):
'command']) 'command'])
class TryCmdTestCase(test.BaseTestCase): class TryCmdTestCase(test_base.BaseTestCase):
def test_keep_warnings(self): def test_keep_warnings(self):
self.useFixture(fixtures.MonkeyPatch( self.useFixture(fixtures.MonkeyPatch(
'openstack.common.processutils.execute', fake_execute)) 'openstack.common.processutils.execute', fake_execute))
@@ -261,7 +261,7 @@ class FakeSshConnection(object):
six.StringIO('stderr')) six.StringIO('stderr'))
class SshExecuteTestCase(test.BaseTestCase): class SshExecuteTestCase(test_base.BaseTestCase):
def test_invalid_addl_env(self): def test_invalid_addl_env(self):
self.assertRaises(processutils.InvalidArgumentError, self.assertRaises(processutils.InvalidArgumentError,
processutils.ssh_execute, processutils.ssh_execute,