Remove mox dependency
There's no need to use it anymore as everything including the oslotest library relies on mox3. Change-Id: If1745adae209b3ea7a9e7ae4a44b38564b5b6bce
This commit is contained in:
@@ -19,7 +19,7 @@ import uuid
|
|||||||
from cinderclient import exceptions as cinder_exception
|
from cinderclient import exceptions as cinder_exception
|
||||||
from eventlet import event as eventlet_event
|
from eventlet import event as eventlet_event
|
||||||
import mock
|
import mock
|
||||||
import mox
|
from mox3 import mox
|
||||||
from oslo.config import cfg
|
from oslo.config import cfg
|
||||||
from oslo import messaging
|
from oslo import messaging
|
||||||
from oslo.utils import importutils
|
from oslo.utils import importutils
|
||||||
@@ -128,10 +128,12 @@ class ComputeManagerUnitTestCase(test.NoDBTestCase):
|
|||||||
def test_allocate_network_maintains_context(self):
|
def test_allocate_network_maintains_context(self):
|
||||||
# override tracker with a version that doesn't need the database:
|
# override tracker with a version that doesn't need the database:
|
||||||
class FakeResourceTracker(object):
|
class FakeResourceTracker(object):
|
||||||
def instance_claim(self, context, instance, limits):
|
@staticmethod
|
||||||
return mox.MockAnything()
|
def instance_claim(context, instance, limits):
|
||||||
|
return mock.MagicMock()
|
||||||
|
|
||||||
self.mox.StubOutWithMock(self.compute, '_get_resource_tracker')
|
self.mox.StubOutWithMock(self.compute, '_get_resource_tracker')
|
||||||
|
self.mox.StubOutWithMock(self.compute, '_reschedule_or_error')
|
||||||
self.mox.StubOutWithMock(self.compute, '_allocate_network')
|
self.mox.StubOutWithMock(self.compute, '_allocate_network')
|
||||||
self.mox.StubOutWithMock(objects.BlockDeviceMappingList,
|
self.mox.StubOutWithMock(objects.BlockDeviceMappingList,
|
||||||
'get_by_instance_uuid')
|
'get_by_instance_uuid')
|
||||||
@@ -150,6 +152,7 @@ class ComputeManagerUnitTestCase(test.NoDBTestCase):
|
|||||||
def fake_allocate(context, *args, **kwargs):
|
def fake_allocate(context, *args, **kwargs):
|
||||||
if context.is_admin:
|
if context.is_admin:
|
||||||
self.admin_context = True
|
self.admin_context = True
|
||||||
|
raise test.TestingException()
|
||||||
|
|
||||||
# NOTE(vish): The nice mox parameter matchers here don't work well
|
# NOTE(vish): The nice mox parameter matchers here don't work well
|
||||||
# because they raise an exception that gets wrapped by
|
# because they raise an exception that gets wrapped by
|
||||||
@@ -160,16 +163,22 @@ class ComputeManagerUnitTestCase(test.NoDBTestCase):
|
|||||||
mox.IgnoreArg(), mox.IgnoreArg(), mox.IgnoreArg(),
|
mox.IgnoreArg(), mox.IgnoreArg(), mox.IgnoreArg(),
|
||||||
mox.IgnoreArg()).WithSideEffects(fake_allocate)
|
mox.IgnoreArg()).WithSideEffects(fake_allocate)
|
||||||
|
|
||||||
|
self.compute._reschedule_or_error(mox.IgnoreArg(), instance,
|
||||||
|
mox.IgnoreArg(), mox.IgnoreArg(), mox.IgnoreArg(),
|
||||||
|
mox.IgnoreArg(), mox.IgnoreArg(), mox.IgnoreArg(),
|
||||||
|
mox.IgnoreArg(), mox.IgnoreArg(),
|
||||||
|
mox.IgnoreArg())
|
||||||
|
|
||||||
self.mox.ReplayAll()
|
self.mox.ReplayAll()
|
||||||
|
|
||||||
instance, nw_info = self.compute._build_instance(self.context, {}, {},
|
self.assertRaises(test.TestingException,
|
||||||
None, None, None, True,
|
self.compute._build_instance,
|
||||||
node, instance,
|
self.context, {}, {},
|
||||||
{}, False)
|
None, None, None, True,
|
||||||
|
node, instance,
|
||||||
|
{}, False)
|
||||||
self.assertFalse(self.admin_context,
|
self.assertFalse(self.admin_context,
|
||||||
"_allocate_network called with admin context")
|
"_allocate_network called with admin context")
|
||||||
self.assertEqual(vm_states.BUILDING, instance.vm_state)
|
|
||||||
self.assertEqual(task_states.BLOCK_DEVICE_MAPPING, instance.task_state)
|
|
||||||
|
|
||||||
def test_reschedule_maintains_context(self):
|
def test_reschedule_maintains_context(self):
|
||||||
# override tracker with a version that causes a reschedule
|
# override tracker with a version that causes a reschedule
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ import time
|
|||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
import mock
|
import mock
|
||||||
import mox
|
from mox3 import mox
|
||||||
from oslo.config import cfg
|
from oslo.config import cfg
|
||||||
from oslo.utils import units
|
from oslo.utils import units
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ feedparser
|
|||||||
fixtures>=0.3.14
|
fixtures>=0.3.14
|
||||||
libvirt-python>=1.2.5 # LGPLv2+
|
libvirt-python>=1.2.5 # LGPLv2+
|
||||||
mock>=1.0
|
mock>=1.0
|
||||||
mox>=0.5.3
|
|
||||||
mox3>=0.7.0
|
mox3>=0.7.0
|
||||||
MySQL-python
|
MySQL-python
|
||||||
psycopg2
|
psycopg2
|
||||||
|
|||||||
Reference in New Issue
Block a user