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/oslotest/latest/api/oslotest.mockpatch.html#module-oslotest.mockpatch

Change-Id: I21306034427447221d2a27f5ed52a0f1fdb6a95e
This commit is contained in:
Luong Anh Tuan 2017-07-12 23:47:05 +07:00
parent 952b6225d5
commit 08bdc31572
2 changed files with 6 additions and 6 deletions

View File

@ -18,12 +18,12 @@ import logging
import os
import unittest
import fixtures
import six
from six.moves import mock
import testtools
from oslotest import base
from oslotest import mockpatch
class TestBaseTestCase(testtools.TestCase):
@ -125,7 +125,7 @@ class TestManualMock(base.BaseTestCase):
patcher.start()
self.addCleanup(patcher.stop)
super(TestManualMock, self).setUp()
self.useFixture(mockpatch.Patch('fixtures.Timeout'))
self.useFixture(fixtures.MockPatch('fixtures.Timeout'))
self.unstopped = mock.patch('os.environ.put')
def tearDown(self):

View File

@ -12,15 +12,15 @@
# License for the specific language governing permissions and limitations
# under the License.
import fixtures
from oslotest import base
from oslotest import mockpatch
class TestMockPatchSymbols(base.BaseTestCase):
def test_reference(self):
# Applications expect these public symbols to be available until the
# deprecated module is removed.
self.assertTrue(mockpatch.PatchObject)
self.assertTrue(mockpatch.Patch)
self.assertTrue(mockpatch.Multiple)
self.assertTrue(fixtures.MockPatchObject)
self.assertTrue(fixtures.MockPatch)
self.assertTrue(fixtures.MockPatchMultiple)