Using fixtures instead of deprecated mockpatch module
This module mockpatch of oslotest[1] is deprecated since version 1.13 and may be removed in version 2.0. Use fixtures.Mock* classes instead[2] [1]OpenStack Testing Framework and Utilities [2]https://docs.openstack.org/developer/oslotest/api/oslotest.mockpatch.html#module-oslotest.mockpatch Change-Id: I844bd3ddb5ac6da4364c9034dcccdaa5265c1658
This commit is contained in:
parent
25a143d89a
commit
9a78a83d9d
|
@ -18,7 +18,6 @@ import fixtures
|
|||
import mox
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
from oslotest import mockpatch
|
||||
import testscenarios
|
||||
import testtools
|
||||
|
||||
|
@ -203,14 +202,15 @@ class HeatTestCase(testscenarios.WithScenarios,
|
|||
generic_rsrc.ResourceWithHiddenPropertyAndAttribute)
|
||||
|
||||
def patchobject(self, obj, attr, **kwargs):
|
||||
mockfixture = self.useFixture(mockpatch.PatchObject(obj, attr,
|
||||
**kwargs))
|
||||
mockfixture = self.useFixture(fixtures.MockPatchObject(obj, attr,
|
||||
**kwargs))
|
||||
return mockfixture.mock
|
||||
|
||||
# NOTE(pshchelo): this overrides the testtools.TestCase.patch method
|
||||
# that does simple monkey-patching in favor of mock's patching
|
||||
def patch(self, target, **kwargs):
|
||||
mockfixture = self.useFixture(mockpatch.Patch(target, **kwargs))
|
||||
mockfixture = self.useFixture(fixtures.MockPatch(target,
|
||||
**kwargs))
|
||||
return mockfixture.mock
|
||||
|
||||
def stub_auth(self, ctx=None, **kwargs):
|
||||
|
|
|
@ -16,7 +16,6 @@ import hashlib
|
|||
import json
|
||||
|
||||
import fixtures
|
||||
from oslotest import mockpatch
|
||||
import six
|
||||
from stevedore import extension
|
||||
|
||||
|
@ -109,7 +108,7 @@ class TemplatePluginFixture(fixtures.Fixture):
|
|||
template._template_classes = None
|
||||
|
||||
clear_template_classes()
|
||||
self.useFixture(mockpatch.PatchObject(
|
||||
self.useFixture(fixtures.MockPatchObject(
|
||||
template,
|
||||
'_get_template_extension_manager',
|
||||
new=self._get_template_extension_manager))
|
||||
|
|
Loading…
Reference in New Issue