Remove deprecated oslotest.mockpatch usage

It is deprecated[1] and will be removed soon.

[1] https://docs.openstack.org/oslotest/latest/reference/api/oslotest.mockpatch.html

Change-Id: I06f12724c7e64057f1c5971f4847f878a3f87a51
Closes-Bug: #1712017
This commit is contained in:
Thomas Bechtold 2017-08-21 11:46:58 +02:00 committed by Jon Schlueter
parent 0ce7a9d7f3
commit 808a5b14fc
1 changed files with 3 additions and 4 deletions

View File

@ -14,7 +14,6 @@ import logging
import os
import fixtures
from oslotest import mockpatch
import testscenarios
import testtools
@ -67,12 +66,12 @@ class BileanTestCase(testscenarios.WithScenarios,
self.addCleanup(utils.reset_dummy_db)
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