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:
parent
952b6225d5
commit
08bdc31572
@ -18,12 +18,12 @@ import logging
|
|||||||
import os
|
import os
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
|
import fixtures
|
||||||
import six
|
import six
|
||||||
from six.moves import mock
|
from six.moves import mock
|
||||||
import testtools
|
import testtools
|
||||||
|
|
||||||
from oslotest import base
|
from oslotest import base
|
||||||
from oslotest import mockpatch
|
|
||||||
|
|
||||||
|
|
||||||
class TestBaseTestCase(testtools.TestCase):
|
class TestBaseTestCase(testtools.TestCase):
|
||||||
@ -125,7 +125,7 @@ class TestManualMock(base.BaseTestCase):
|
|||||||
patcher.start()
|
patcher.start()
|
||||||
self.addCleanup(patcher.stop)
|
self.addCleanup(patcher.stop)
|
||||||
super(TestManualMock, self).setUp()
|
super(TestManualMock, self).setUp()
|
||||||
self.useFixture(mockpatch.Patch('fixtures.Timeout'))
|
self.useFixture(fixtures.MockPatch('fixtures.Timeout'))
|
||||||
self.unstopped = mock.patch('os.environ.put')
|
self.unstopped = mock.patch('os.environ.put')
|
||||||
|
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
|
@ -12,15 +12,15 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
|
import fixtures
|
||||||
|
|
||||||
from oslotest import base
|
from oslotest import base
|
||||||
from oslotest import mockpatch
|
|
||||||
|
|
||||||
|
|
||||||
class TestMockPatchSymbols(base.BaseTestCase):
|
class TestMockPatchSymbols(base.BaseTestCase):
|
||||||
def test_reference(self):
|
def test_reference(self):
|
||||||
# Applications expect these public symbols to be available until the
|
# Applications expect these public symbols to be available until the
|
||||||
# deprecated module is removed.
|
# deprecated module is removed.
|
||||||
self.assertTrue(mockpatch.PatchObject)
|
self.assertTrue(fixtures.MockPatchObject)
|
||||||
self.assertTrue(mockpatch.Patch)
|
self.assertTrue(fixtures.MockPatch)
|
||||||
self.assertTrue(mockpatch.Multiple)
|
self.assertTrue(fixtures.MockPatchMultiple)
|
||||||
|
Loading…
Reference in New Issue
Block a user