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:
parent
c7fa186512
commit
9d86c94dc4
|
@ -16,16 +16,16 @@ import logging
|
|||
import time
|
||||
|
||||
import mock
|
||||
from oslotest import base as test_base
|
||||
|
||||
from openstack.common import excutils
|
||||
from openstack.common.fixture import moxstubout
|
||||
from openstack.common import test
|
||||
|
||||
|
||||
mox = moxstubout.mox
|
||||
|
||||
|
||||
class SaveAndReraiseTest(test.BaseTestCase):
|
||||
class SaveAndReraiseTest(test_base.BaseTestCase):
|
||||
|
||||
def test_save_and_reraise_exception(self):
|
||||
e = None
|
||||
|
@ -82,7 +82,7 @@ class SaveAndReraiseTest(test.BaseTestCase):
|
|||
self.assertFalse(log.called)
|
||||
|
||||
|
||||
class ForeverRetryUncaughtExceptionsTest(test.BaseTestCase):
|
||||
class ForeverRetryUncaughtExceptionsTest(test_base.BaseTestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(ForeverRetryUncaughtExceptionsTest, self).setUp()
|
||||
|
|
|
@ -16,11 +16,12 @@
|
|||
import datetime
|
||||
import sys
|
||||
|
||||
from oslotest import base as test_base
|
||||
|
||||
from openstack.common import importutils
|
||||
from openstack.common import test
|
||||
|
||||
|
||||
class ImportUtilsTest(test.BaseTestCase):
|
||||
class ImportUtilsTest(test_base.BaseTestCase):
|
||||
|
||||
# NOTE(jkoelker) There has GOT to be a way to test this. But mocking
|
||||
# __import__ is the devil. Right now we just make
|
||||
|
|
|
@ -13,11 +13,12 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from oslotest import base as test_base
|
||||
|
||||
from openstack.common import network_utils
|
||||
from openstack.common import test
|
||||
|
||||
|
||||
class NetworkUtilsTest(test.BaseTestCase):
|
||||
class NetworkUtilsTest(test_base.BaseTestCase):
|
||||
|
||||
def test_parse_host_port(self):
|
||||
self.assertEqual(('server01', 80),
|
||||
|
|
|
@ -18,17 +18,17 @@
|
|||
import math
|
||||
|
||||
import mock
|
||||
from oslotest import base as test_base
|
||||
import six
|
||||
import testscenarios
|
||||
|
||||
from openstack.common import strutils
|
||||
from openstack.common import test
|
||||
from openstack.common import units
|
||||
|
||||
load_tests = testscenarios.load_tests_apply_scenarios
|
||||
|
||||
|
||||
class StrUtilsTest(test.BaseTestCase):
|
||||
class StrUtilsTest(test_base.BaseTestCase):
|
||||
|
||||
def test_bool_bool_from_string(self):
|
||||
self.assertTrue(strutils.bool_from_string(True))
|
||||
|
@ -201,7 +201,7 @@ class StrUtilsTest(test.BaseTestCase):
|
|||
to_slug("\x80strange", errors="ignore"))
|
||||
|
||||
|
||||
class StringToBytesTest(test.BaseTestCase):
|
||||
class StringToBytesTest(test_base.BaseTestCase):
|
||||
|
||||
_unit_system = [
|
||||
('si', dict(unit_system='SI')),
|
||||
|
|
|
@ -19,13 +19,13 @@ import time
|
|||
|
||||
import iso8601
|
||||
import mock
|
||||
from oslotest import base as test_base
|
||||
from testtools import matchers
|
||||
|
||||
from openstack.common import test
|
||||
from openstack.common import timeutils
|
||||
|
||||
|
||||
class TimeUtilsTest(test.BaseTestCase):
|
||||
class TimeUtilsTest(test_base.BaseTestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(TimeUtilsTest, self).setUp()
|
||||
|
@ -215,7 +215,7 @@ class TimeUtilsTest(test.BaseTestCase):
|
|||
self.assertTrue(timeutils.is_soon(expires, 0))
|
||||
|
||||
|
||||
class TestIso8601Time(test.BaseTestCase):
|
||||
class TestIso8601Time(test_base.BaseTestCase):
|
||||
|
||||
def _instaneous(self, timestamp, yr, mon, day, hr, minute, sec, micro):
|
||||
self.assertEqual(timestamp.year, yr)
|
||||
|
|
Loading…
Reference in New Issue