From f43c1f76559ae8b5b738b7ae8b69b15c379f9145 Mon Sep 17 00:00:00 2001 From: Dean Troyer Date: Mon, 13 Apr 2015 16:47:49 -0500 Subject: Defer client imports So we really weren't deferring the loading of client libs dadgummit, do that for real where possible. This shaves a couple of tenths off the static import times. Also defer as much import-time procesing as possible. This is a little ugly in api.auth but this also eliminates import of the auth plugins until they are needed. Change-Id: Ia11d4b9cf98231d37449103fc29101dc17afb009 --- openstackclient/tests/common/test_clientmanager.py | 4 ++++ openstackclient/tests/volume/test_find_resource.py | 7 +++++++ 2 files changed, 11 insertions(+) (limited to 'openstackclient/tests') diff --git a/openstackclient/tests/common/test_clientmanager.py b/openstackclient/tests/common/test_clientmanager.py index 3648bf57..7a2f57be 100644 --- a/openstackclient/tests/common/test_clientmanager.py +++ b/openstackclient/tests/common/test_clientmanager.py @@ -34,6 +34,10 @@ AUTH_REF.update(fakes.TEST_RESPONSE_DICT['access']) SERVICE_CATALOG = service_catalog.ServiceCatalogV2(AUTH_REF) +# This is deferred in api.auth but we need it here... +auth.get_options_list() + + class Container(object): attr = clientmanager.ClientCache(lambda x: object()) diff --git a/openstackclient/tests/volume/test_find_resource.py b/openstackclient/tests/volume/test_find_resource.py index 56081966..00cc46a6 100644 --- a/openstackclient/tests/volume/test_find_resource.py +++ b/openstackclient/tests/volume/test_find_resource.py @@ -24,6 +24,13 @@ from openstackclient.tests import utils as test_utils from openstackclient.volume import client # noqa +# Monkey patch for v1 cinderclient +# NOTE(dtroyer): Do here because openstackclient.volume.client +# doesn't do it until the client object is created now. +volumes.Volume.NAME_ATTR = 'display_name' +volume_snapshots.Snapshot.NAME_ATTR = 'display_name' + + ID = '1after909' NAME = 'PhilSpector' -- cgit v1.2.1