Merge "Using fixtures instead of deprecated mockpatch module"
This commit is contained in:
commit
767fe05890
@ -15,13 +15,13 @@
|
|||||||
import tempfile
|
import tempfile
|
||||||
|
|
||||||
import ddt
|
import ddt
|
||||||
|
import fixtures
|
||||||
import mock
|
import mock
|
||||||
|
|
||||||
from rally.plugins.openstack.services.image import glance_v1
|
from rally.plugins.openstack.services.image import glance_v1
|
||||||
from rally.plugins.openstack.services.image import image
|
from rally.plugins.openstack.services.image import image
|
||||||
from tests.unit import test
|
from tests.unit import test
|
||||||
|
|
||||||
from oslotest import mockpatch
|
|
||||||
|
|
||||||
PATH = ("rally.plugins.openstack.services.image.glance_common."
|
PATH = ("rally.plugins.openstack.services.image.glance_common."
|
||||||
"UnifiedGlanceMixin._unify_image")
|
"UnifiedGlanceMixin._unify_image")
|
||||||
@ -38,7 +38,7 @@ class GlanceV1ServiceTestCase(test.TestCase):
|
|||||||
self.name_generator = mock.MagicMock()
|
self.name_generator = mock.MagicMock()
|
||||||
self.service = glance_v1.GlanceV1Service(
|
self.service = glance_v1.GlanceV1Service(
|
||||||
self.clients, name_generator=self.name_generator)
|
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")
|
"rally.task.utils.wait_for_status")
|
||||||
self.useFixture(self.mock_wait_for_status)
|
self.useFixture(self.mock_wait_for_status)
|
||||||
|
|
||||||
|
@ -15,12 +15,12 @@
|
|||||||
import tempfile
|
import tempfile
|
||||||
|
|
||||||
import ddt
|
import ddt
|
||||||
|
import fixtures
|
||||||
import mock
|
import mock
|
||||||
|
|
||||||
from rally.plugins.openstack.services.image import glance_v2
|
from rally.plugins.openstack.services.image import glance_v2
|
||||||
from tests.unit import test
|
from tests.unit import test
|
||||||
|
|
||||||
from oslotest import mockpatch
|
|
||||||
|
|
||||||
PATH = ("rally.plugins.openstack.services.image.glance_common."
|
PATH = ("rally.plugins.openstack.services.image.glance_common."
|
||||||
"UnifiedGlanceMixin._unify_image")
|
"UnifiedGlanceMixin._unify_image")
|
||||||
@ -37,7 +37,7 @@ class GlanceV2ServiceTestCase(test.TestCase):
|
|||||||
self.name_generator = mock.MagicMock()
|
self.name_generator = mock.MagicMock()
|
||||||
self.service = glance_v2.GlanceV2Service(
|
self.service = glance_v2.GlanceV2Service(
|
||||||
self.clients, name_generator=self.name_generator)
|
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")
|
"rally.task.utils.wait_for_status")
|
||||||
self.useFixture(self.mock_wait_for_status)
|
self.useFixture(self.mock_wait_for_status)
|
||||||
|
|
||||||
|
@ -12,10 +12,10 @@
|
|||||||
# 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 ddt
|
import ddt
|
||||||
|
import fixtures
|
||||||
import mock
|
import mock
|
||||||
from oslotest import mockpatch
|
|
||||||
from rally.plugins.openstack.credential import OpenStackCredential
|
from rally.plugins.openstack.credential import OpenStackCredential
|
||||||
from rally.plugins.openstack import scenario as base_scenario
|
from rally.plugins.openstack import scenario as base_scenario
|
||||||
from tests.unit import test
|
from tests.unit import test
|
||||||
@ -37,8 +37,7 @@ CREDENTIAL_WITH_HMAC = OpenStackCredential(
|
|||||||
class OpenStackScenarioTestCase(test.TestCase):
|
class OpenStackScenarioTestCase(test.TestCase):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(OpenStackScenarioTestCase, self).setUp()
|
super(OpenStackScenarioTestCase, self).setUp()
|
||||||
self.osclients = mockpatch.Patch(
|
self.osclients = fixtures.MockPatch("rally.osclients.Clients")
|
||||||
"rally.osclients.Clients")
|
|
||||||
self.useFixture(self.osclients)
|
self.useFixture(self.osclients)
|
||||||
self.context = test.get_test_context()
|
self.context = test.get_test_context()
|
||||||
self.context.update({"foo": "bar"})
|
self.context.update({"foo": "bar"})
|
||||||
|
@ -13,13 +13,13 @@
|
|||||||
# 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
|
||||||
import os
|
import os
|
||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
import mock
|
import mock
|
||||||
from oslo_config import fixture
|
from oslo_config import fixture
|
||||||
from oslotest import base
|
from oslotest import base
|
||||||
from oslotest import mockpatch
|
|
||||||
|
|
||||||
from rally.common import db
|
from rally.common import db
|
||||||
from rally import plugins
|
from rally import plugins
|
||||||
@ -119,15 +119,15 @@ class ScenarioTestCase(TestCase):
|
|||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(ScenarioTestCase, self).setUp()
|
super(ScenarioTestCase, self).setUp()
|
||||||
if self.patch_benchmark_utils:
|
if self.patch_benchmark_utils:
|
||||||
self.mock_resource_is = mockpatch.Patch(
|
self.mock_resource_is = fixtures.MockPatch(
|
||||||
self.benchmark_utils + ".resource_is")
|
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.benchmark_utils + ".get_from_manager")
|
||||||
self.mock_wait_for = mockpatch.Patch(
|
self.mock_wait_for = fixtures.MockPatch(
|
||||||
self.benchmark_utils + ".wait_for")
|
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.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.benchmark_utils + ".wait_for_status")
|
||||||
self.useFixture(self.mock_resource_is)
|
self.useFixture(self.mock_resource_is)
|
||||||
self.useFixture(self.mock_get_from_manager)
|
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_delete)
|
||||||
self.useFixture(self.mock_wait_for_status)
|
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.useFixture(self.mock_sleep)
|
||||||
|
|
||||||
self._clients = {}
|
self._clients = {}
|
||||||
|
Loading…
Reference in New Issue
Block a user