Merge "Stop using oslotest.mockpatch"
This commit is contained in:
@@ -22,7 +22,6 @@ import logging
|
|||||||
import fixtures
|
import fixtures
|
||||||
import mock
|
import mock
|
||||||
from oslotest import base
|
from oslotest import base
|
||||||
from oslotest import mockpatch
|
|
||||||
import six
|
import six
|
||||||
|
|
||||||
from testtools import compat
|
from testtools import compat
|
||||||
@@ -198,8 +197,8 @@ class MockTestCase(TestCase):
|
|||||||
|
|
||||||
def patch(self, target, autospec=True, **kwargs):
|
def patch(self, target, autospec=True, **kwargs):
|
||||||
"""Patch target and attach it to the master mock."""
|
"""Patch target and attach it to the master mock."""
|
||||||
f = self.useFixture(mockpatch.Patch(target,
|
f = self.useFixture(fixtures.MockPatch(target,
|
||||||
autospec=autospec, **kwargs))
|
autospec=autospec, **kwargs))
|
||||||
mocked = f.mock
|
mocked = f.mock
|
||||||
attach_as = kwargs.pop('attach_as', None)
|
attach_as = kwargs.pop('attach_as', None)
|
||||||
if attach_as is not None:
|
if attach_as is not None:
|
||||||
@@ -218,8 +217,8 @@ class MockTestCase(TestCase):
|
|||||||
else:
|
else:
|
||||||
instance_mock = mock.Mock()
|
instance_mock = mock.Mock()
|
||||||
|
|
||||||
f = self.useFixture(mockpatch.PatchObject(module, name,
|
f = self.useFixture(fixtures.MockPatchObject(module, name,
|
||||||
autospec=autospec))
|
autospec=autospec))
|
||||||
class_mock = f.mock
|
class_mock = f.mock
|
||||||
class_mock.return_value = instance_mock
|
class_mock.return_value = instance_mock
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user