Merge "Remove deprecated oslotest.mockpatch usage"

This commit is contained in:
Zuul 2017-10-27 06:23:46 +00:00 committed by Gerrit Code Review
commit 5503d44ee5
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