summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuong Anh Tuan <tuanla@vn.fujitsu.com>2017-07-12 23:47:05 +0700
committerLuong Anh Tuan <tuanla@vn.fujitsu.com>2017-07-12 23:47:58 +0700
commit08bdc3157236617b705fe4bd1a9ce2629602db80 (patch)
treebe99b58b8f5f1f5534536e0eac7b14316437d35c
parent952b6225d5134b4e18d08efb9347aa7198235a5f (diff)
downloadoslotest-08bdc3157236617b705fe4bd1a9ce2629602db80.tar.gz
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
-rw-r--r--oslotest/tests/unit/test_base.py4
-rw-r--r--oslotest/tests/unit/test_mockpatch.py8
2 files changed, 6 insertions, 6 deletions
diff --git a/oslotest/tests/unit/test_base.py b/oslotest/tests/unit/test_base.py
index 00493c7..5e24136 100644
--- a/oslotest/tests/unit/test_base.py
+++ b/oslotest/tests/unit/test_base.py
@@ -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):
diff --git a/oslotest/tests/unit/test_mockpatch.py b/oslotest/tests/unit/test_mockpatch.py
index dc1c247..1561814 100644
--- a/oslotest/tests/unit/test_mockpatch.py
+++ b/oslotest/tests/unit/test_mockpatch.py
@@ -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)