Merge "Using fixtures instead of deprecated mockpatch module"

This commit is contained in:
Jenkins 2017-06-01 01:22:23 +00:00 committed by Gerrit Code Review
commit 767fe05890
4 changed files with 14 additions and 15 deletions

View File

@ -15,13 +15,13 @@
import tempfile
import ddt
import fixtures
import mock
from rally.plugins.openstack.services.image import glance_v1
from rally.plugins.openstack.services.image import image
from tests.unit import test
from oslotest import mockpatch
PATH = ("rally.plugins.openstack.services.image.glance_common."
"UnifiedGlanceMixin._unify_image")
@ -38,7 +38,7 @@ class GlanceV1ServiceTestCase(test.TestCase):
self.name_generator = mock.MagicMock()
self.service = glance_v1.GlanceV1Service(
self.clients, name_generator=self.name_generator)
self.mock_wait_for_status = mockpatch.Patch(
self.mock_wait_for_status = fixtures.MockPatch(
"rally.task.utils.wait_for_status")
self.useFixture(self.mock_wait_for_status)

View File

@ -15,12 +15,12 @@
import tempfile
import ddt
import fixtures
import mock
from rally.plugins.openstack.services.image import glance_v2
from tests.unit import test
from oslotest import mockpatch
PATH = ("rally.plugins.openstack.services.image.glance_common."
"UnifiedGlanceMixin._unify_image")
@ -37,7 +37,7 @@ class GlanceV2ServiceTestCase(test.TestCase):
self.name_generator = mock.MagicMock()
self.service = glance_v2.GlanceV2Service(
self.clients, name_generator=self.name_generator)
self.mock_wait_for_status = mockpatch.Patch(
self.mock_wait_for_status = fixtures.MockPatch(
"rally.task.utils.wait_for_status")
self.useFixture(self.mock_wait_for_status)

View File

@ -12,10 +12,10 @@
# License for the specific language governing permissions and limitations
# under the License.
import ddt
import fixtures
import mock
from oslotest import mockpatch
from rally.plugins.openstack.credential import OpenStackCredential
from rally.plugins.openstack import scenario as base_scenario
from tests.unit import test
@ -37,8 +37,7 @@ CREDENTIAL_WITH_HMAC = OpenStackCredential(
class OpenStackScenarioTestCase(test.TestCase):
def setUp(self):
super(OpenStackScenarioTestCase, self).setUp()
self.osclients = mockpatch.Patch(
"rally.osclients.Clients")
self.osclients = fixtures.MockPatch("rally.osclients.Clients")
self.useFixture(self.osclients)
self.context = test.get_test_context()
self.context.update({"foo": "bar"})

View File

@ -13,13 +13,13 @@
# License for the specific language governing permissions and limitations
# under the License.
import fixtures
import os
import uuid
import mock
from oslo_config import fixture
from oslotest import base
from oslotest import mockpatch
from rally.common import db
from rally import plugins
@ -119,15 +119,15 @@ class ScenarioTestCase(TestCase):
def setUp(self):
super(ScenarioTestCase, self).setUp()
if self.patch_benchmark_utils:
self.mock_resource_is = mockpatch.Patch(
self.mock_resource_is = fixtures.MockPatch(
self.benchmark_utils + ".resource_is")
self.mock_get_from_manager = mockpatch.Patch(
self.mock_get_from_manager = fixtures.MockPatch(
self.benchmark_utils + ".get_from_manager")
self.mock_wait_for = mockpatch.Patch(
self.mock_wait_for = fixtures.MockPatch(
self.benchmark_utils + ".wait_for")
self.mock_wait_for_delete = mockpatch.Patch(
self.mock_wait_for_delete = fixtures.MockPatch(
self.benchmark_utils + ".wait_for_delete")
self.mock_wait_for_status = mockpatch.Patch(
self.mock_wait_for_status = fixtures.MockPatch(
self.benchmark_utils + ".wait_for_status")
self.useFixture(self.mock_resource_is)
self.useFixture(self.mock_get_from_manager)
@ -135,7 +135,7 @@ class ScenarioTestCase(TestCase):
self.useFixture(self.mock_wait_for_delete)
self.useFixture(self.mock_wait_for_status)
self.mock_sleep = mockpatch.Patch("time.sleep")
self.mock_sleep = fixtures.MockPatch("time.sleep")
self.useFixture(self.mock_sleep)
self._clients = {}