From 08bdc3157236617b705fe4bd1a9ce2629602db80 Mon Sep 17 00:00:00 2001 From: Luong Anh Tuan Date: Wed, 12 Jul 2017 23:47:05 +0700 Subject: [PATCH] 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 --- oslotest/tests/unit/test_base.py | 4 ++-- oslotest/tests/unit/test_mockpatch.py | 8 ++++---- 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)