From 745adb323f80581764f43f9239f48eb210be71f7 Mon Sep 17 00:00:00 2001 From: vponomaryov Date: Mon, 20 Oct 2014 11:51:16 +0300 Subject: [PATCH] Move tests into manilaclient package tests/__init__.py implies a package in the global namespace called tests. That's not what these are, they are tests in the manilaclient namespace. Also moved unit tests to dir 'unit', it is done so because 'functional' tests are expected to be added. Change-Id: I801214b865e9cef8db7511f209dcf3c26b75d70f --- .testr.conf | 4 ++-- {tests => manilaclient/tests}/__init__.py | 0 {tests/v1 => manilaclient/tests/unit}/__init__.py | 0 {tests => manilaclient/tests/unit}/fakes.py | 0 {tests => manilaclient/tests/unit}/test_base.py | 4 ++-- {tests => manilaclient/tests/unit}/test_client.py | 2 +- {tests => manilaclient/tests/unit}/test_http.py | 2 +- {tests => manilaclient/tests/unit}/test_service_catalog.py | 2 +- {tests => manilaclient/tests/unit}/test_shell.py | 6 +++--- {tests => manilaclient/tests/unit}/utils.py | 0 manilaclient/tests/unit/v1/__init__.py | 0 {tests => manilaclient/tests/unit}/v1/fake_clients.py | 4 ++-- {tests => manilaclient/tests/unit}/v1/fakes.py | 2 +- {tests => manilaclient/tests/unit}/v1/test_auth.py | 2 +- {tests => manilaclient/tests/unit}/v1/test_quota_classes.py | 4 ++-- {tests => manilaclient/tests/unit}/v1/test_quotas.py | 4 ++-- .../tests/unit}/v1/test_security_services.py | 4 ++-- {tests => manilaclient/tests/unit}/v1/test_services.py | 2 +- .../tests/unit}/v1/test_share_networks.py | 4 ++-- {tests => manilaclient/tests/unit}/v1/test_share_servers.py | 2 +- .../tests/unit}/v1/test_share_snapshots.py | 4 ++-- {tests => manilaclient/tests/unit}/v1/test_shares.py | 4 ++-- {tests => manilaclient/tests/unit}/v1/test_shell.py | 4 ++-- {tests => manilaclient/tests/unit}/v1/test_types.py | 4 ++-- tests/old/contrib/__init__.py | 1 - 25 files changed, 32 insertions(+), 33 deletions(-) rename {tests => manilaclient/tests}/__init__.py (100%) rename {tests/v1 => manilaclient/tests/unit}/__init__.py (100%) rename {tests => manilaclient/tests/unit}/fakes.py (100%) rename {tests => manilaclient/tests/unit}/test_base.py (95%) rename {tests => manilaclient/tests/unit}/test_client.py (95%) rename {tests => manilaclient/tests/unit}/test_http.py (99%) rename {tests => manilaclient/tests/unit}/test_service_catalog.py (99%) rename {tests => manilaclient/tests/unit}/test_shell.py (95%) rename {tests => manilaclient/tests/unit}/utils.py (100%) create mode 100644 manilaclient/tests/unit/v1/__init__.py rename {tests => manilaclient/tests/unit}/v1/fake_clients.py (98%) rename {tests => manilaclient/tests/unit}/v1/fakes.py (99%) rename {tests => manilaclient/tests/unit}/v1/test_auth.py (99%) rename {tests => manilaclient/tests/unit}/v1/test_quota_classes.py (93%) rename {tests => manilaclient/tests/unit}/v1/test_quotas.py (97%) rename {tests => manilaclient/tests/unit}/v1/test_security_services.py (98%) rename {tests => manilaclient/tests/unit}/v1/test_services.py (98%) rename {tests => manilaclient/tests/unit}/v1/test_share_networks.py (98%) rename {tests => manilaclient/tests/unit}/v1/test_share_servers.py (99%) rename {tests => manilaclient/tests/unit}/v1/test_share_snapshots.py (94%) rename {tests => manilaclient/tests/unit}/v1/test_shares.py (98%) rename {tests => manilaclient/tests/unit}/v1/test_shell.py (99%) rename {tests => manilaclient/tests/unit}/v1/test_types.py (94%) delete mode 100644 tests/old/contrib/__init__.py diff --git a/.testr.conf b/.testr.conf index 0f431fe51..660f3b4da 100644 --- a/.testr.conf +++ b/.testr.conf @@ -2,7 +2,7 @@ test_command=OS_STDOUT_CAPTURE=${OS_STDOUT_CAPTURE:-1} \ OS_STDERR_CAPTURE=${OS_STDERR_CAPTURE:-1} \ OS_TEST_TIMEOUT=${OS_TEST_TIMEOUT:-60} \ - ${PYTHON:-python} -m subunit.run discover -t ./ ./tests $LISTOPT $IDOPTION + ${PYTHON:-python} -m subunit.run discover -t ./ ./manilaclient/tests/unit $LISTOPT $IDOPTION test_id_option=--load-list $IDFILE -test_list_option=--list \ No newline at end of file +test_list_option=--list diff --git a/tests/__init__.py b/manilaclient/tests/__init__.py similarity index 100% rename from tests/__init__.py rename to manilaclient/tests/__init__.py diff --git a/tests/v1/__init__.py b/manilaclient/tests/unit/__init__.py similarity index 100% rename from tests/v1/__init__.py rename to manilaclient/tests/unit/__init__.py diff --git a/tests/fakes.py b/manilaclient/tests/unit/fakes.py similarity index 100% rename from tests/fakes.py rename to manilaclient/tests/unit/fakes.py diff --git a/tests/test_base.py b/manilaclient/tests/unit/test_base.py similarity index 95% rename from tests/test_base.py rename to manilaclient/tests/unit/test_base.py index 217743d6a..07bb1ab9d 100644 --- a/tests/test_base.py +++ b/manilaclient/tests/unit/test_base.py @@ -12,9 +12,9 @@ from manilaclient import exceptions from manilaclient.openstack.common.apiclient import base as common_base +from manilaclient.tests.unit import utils +from manilaclient.tests.unit.v1 import fakes from manilaclient.v1 import shares -from tests import utils -from tests.v1 import fakes cs = fakes.FakeClient() diff --git a/tests/test_client.py b/manilaclient/tests/unit/test_client.py similarity index 95% rename from tests/test_client.py rename to manilaclient/tests/unit/test_client.py index cd82b32e5..540f76d1f 100644 --- a/tests/test_client.py +++ b/manilaclient/tests/unit/test_client.py @@ -11,8 +11,8 @@ # under the License. import manilaclient.client +from manilaclient.tests.unit import utils import manilaclient.v1.client -from tests import utils class ClientTest(utils.TestCase): diff --git a/tests/test_http.py b/manilaclient/tests/unit/test_http.py similarity index 99% rename from tests/test_http.py rename to manilaclient/tests/unit/test_http.py index c21fc950c..08dbe7e15 100644 --- a/tests/test_http.py +++ b/manilaclient/tests/unit/test_http.py @@ -15,7 +15,7 @@ import requests from manilaclient import client from manilaclient import exceptions -from tests import utils +from manilaclient.tests.unit import utils fake_response = utils.TestResponse({ diff --git a/tests/test_service_catalog.py b/manilaclient/tests/unit/test_service_catalog.py similarity index 99% rename from tests/test_service_catalog.py rename to manilaclient/tests/unit/test_service_catalog.py index 4bcebdacc..6c4fe29c4 100644 --- a/tests/test_service_catalog.py +++ b/manilaclient/tests/unit/test_service_catalog.py @@ -12,7 +12,7 @@ from manilaclient import exceptions from manilaclient import service_catalog -from tests import utils +from manilaclient.tests.unit import utils # Taken directly from keystone/content/common/samples/auth.json diff --git a/tests/test_shell.py b/manilaclient/tests/unit/test_shell.py similarity index 95% rename from tests/test_shell.py rename to manilaclient/tests/unit/test_shell.py index c50b3fb7a..ed3480708 100644 --- a/tests/test_shell.py +++ b/manilaclient/tests/unit/test_shell.py @@ -18,8 +18,8 @@ from six import moves from testtools import matchers from manilaclient import exceptions -import manilaclient.shell -from tests import utils +from manilaclient import shell +from manilaclient.tests.unit import utils class ShellTest(utils.TestCase): @@ -42,7 +42,7 @@ class ShellTest(utils.TestCase): orig = sys.stdout try: sys.stdout = moves.StringIO() - _shell = manilaclient.shell.OpenStackManilaShell() + _shell = shell.OpenStackManilaShell() _shell.main(argstr.split()) except SystemExit: exc_type, exc_value, exc_traceback = sys.exc_info() diff --git a/tests/utils.py b/manilaclient/tests/unit/utils.py similarity index 100% rename from tests/utils.py rename to manilaclient/tests/unit/utils.py diff --git a/manilaclient/tests/unit/v1/__init__.py b/manilaclient/tests/unit/v1/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/tests/v1/fake_clients.py b/manilaclient/tests/unit/v1/fake_clients.py similarity index 98% rename from tests/v1/fake_clients.py rename to manilaclient/tests/unit/v1/fake_clients.py index 47f84b7d2..c43e42151 100644 --- a/tests/v1/fake_clients.py +++ b/manilaclient/tests/unit/v1/fake_clients.py @@ -18,9 +18,9 @@ except ImportError: import urllib.parse as urlparse from manilaclient import client as base_client +from manilaclient.tests.unit import fakes +from manilaclient.tests.unit import utils from manilaclient.v1 import client -from tests import fakes -import tests.utils as utils class FakeClient(fakes.FakeClient, client.Client): diff --git a/tests/v1/fakes.py b/manilaclient/tests/unit/v1/fakes.py similarity index 99% rename from tests/v1/fakes.py rename to manilaclient/tests/unit/v1/fakes.py index 5f0134cdb..6df2f5203 100644 --- a/tests/v1/fakes.py +++ b/manilaclient/tests/unit/v1/fakes.py @@ -15,8 +15,8 @@ from __future__ import print_function +from manilaclient.tests.unit.v1 import fake_clients as fakes from manilaclient.v1 import client -from tests.v1 import fake_clients as fakes class FakeClient(fakes.FakeClient): diff --git a/tests/v1/test_auth.py b/manilaclient/tests/unit/v1/test_auth.py similarity index 99% rename from tests/v1/test_auth.py rename to manilaclient/tests/unit/v1/test_auth.py index 4417afa78..ecddf6894 100644 --- a/tests/v1/test_auth.py +++ b/manilaclient/tests/unit/v1/test_auth.py @@ -20,8 +20,8 @@ import mock import requests from manilaclient import exceptions +from manilaclient.tests.unit import utils from manilaclient.v1 import client -from tests import utils class AuthenticateAgainstKeystoneTests(utils.TestCase): diff --git a/tests/v1/test_quota_classes.py b/manilaclient/tests/unit/v1/test_quota_classes.py similarity index 93% rename from tests/v1/test_quota_classes.py rename to manilaclient/tests/unit/v1/test_quota_classes.py index 954bb2b83..90b1bacef 100644 --- a/tests/v1/test_quota_classes.py +++ b/manilaclient/tests/unit/v1/test_quota_classes.py @@ -13,8 +13,8 @@ # License for the specific language governing permissions and limitations # under the License. -from tests import utils -from tests.v1 import fakes +from manilaclient.tests.unit import utils +from manilaclient.tests.unit.v1 import fakes cs = fakes.FakeClient() diff --git a/tests/v1/test_quotas.py b/manilaclient/tests/unit/v1/test_quotas.py similarity index 97% rename from tests/v1/test_quotas.py rename to manilaclient/tests/unit/v1/test_quotas.py index 4a02fd11c..adba1cd9b 100644 --- a/tests/v1/test_quotas.py +++ b/manilaclient/tests/unit/v1/test_quotas.py @@ -13,8 +13,8 @@ # License for the specific language governing permissions and limitations # under the License. -from tests import utils -from tests.v1 import fakes +from manilaclient.tests.unit import utils +from manilaclient.tests.unit.v1 import fakes cs = fakes.FakeClient() diff --git a/tests/v1/test_security_services.py b/manilaclient/tests/unit/v1/test_security_services.py similarity index 98% rename from tests/v1/test_security_services.py rename to manilaclient/tests/unit/v1/test_security_services.py index 36c213d2c..855c1c072 100644 --- a/tests/v1/test_security_services.py +++ b/manilaclient/tests/unit/v1/test_security_services.py @@ -15,9 +15,9 @@ import mock from manilaclient import exceptions +from manilaclient.tests.unit import utils +from manilaclient.tests.unit.v1 import fakes from manilaclient.v1 import security_services -from tests import utils -from tests.v1 import fakes class SecurityServiceTest(utils.TestCase): diff --git a/tests/v1/test_services.py b/manilaclient/tests/unit/v1/test_services.py similarity index 98% rename from tests/v1/test_services.py rename to manilaclient/tests/unit/v1/test_services.py index c3dc65fda..71eecc90a 100644 --- a/tests/v1/test_services.py +++ b/manilaclient/tests/unit/v1/test_services.py @@ -15,8 +15,8 @@ import mock +from manilaclient.tests.unit import utils from manilaclient.v1 import services -from tests import utils class ServicesTest(utils.TestCase): diff --git a/tests/v1/test_share_networks.py b/manilaclient/tests/unit/v1/test_share_networks.py similarity index 98% rename from tests/v1/test_share_networks.py rename to manilaclient/tests/unit/v1/test_share_networks.py index 0a7c8dce4..b87417c19 100644 --- a/tests/v1/test_share_networks.py +++ b/manilaclient/tests/unit/v1/test_share_networks.py @@ -15,9 +15,9 @@ import mock from manilaclient import exceptions +from manilaclient.tests.unit import utils +from manilaclient.tests.unit.v1 import fakes from manilaclient.v1 import share_networks -from tests import utils -from tests.v1 import fakes class ShareNetworkTest(utils.TestCase): diff --git a/tests/v1/test_share_servers.py b/manilaclient/tests/unit/v1/test_share_servers.py similarity index 99% rename from tests/v1/test_share_servers.py rename to manilaclient/tests/unit/v1/test_share_servers.py index f79ca2d9b..ba37dcb23 100644 --- a/tests/v1/test_share_servers.py +++ b/manilaclient/tests/unit/v1/test_share_servers.py @@ -15,8 +15,8 @@ import mock +from manilaclient.tests.unit import utils from manilaclient.v1 import share_servers -from tests import utils class FakeShareServer(object): diff --git a/tests/v1/test_share_snapshots.py b/manilaclient/tests/unit/v1/test_share_snapshots.py similarity index 94% rename from tests/v1/test_share_snapshots.py rename to manilaclient/tests/unit/v1/test_share_snapshots.py index 44945f5be..2f3d7f3d5 100644 --- a/tests/v1/test_share_snapshots.py +++ b/manilaclient/tests/unit/v1/test_share_snapshots.py @@ -16,9 +16,9 @@ # under the License. from manilaclient import extension +from manilaclient.tests.unit import utils +from manilaclient.tests.unit.v1 import fakes from manilaclient.v1 import share_snapshots -from tests import utils -from tests.v1 import fakes extensions = [ diff --git a/tests/v1/test_shares.py b/manilaclient/tests/unit/v1/test_shares.py similarity index 98% rename from tests/v1/test_shares.py rename to manilaclient/tests/unit/v1/test_shares.py index 4f4ec251c..422db3bf5 100644 --- a/tests/v1/test_shares.py +++ b/manilaclient/tests/unit/v1/test_shares.py @@ -19,9 +19,9 @@ import mock from manilaclient import exceptions from manilaclient import extension +from manilaclient.tests.unit import utils +from manilaclient.tests.unit.v1 import fakes from manilaclient.v1 import shares -from tests import utils -from tests.v1 import fakes extensions = [ diff --git a/tests/v1/test_shell.py b/manilaclient/tests/unit/v1/test_shell.py similarity index 99% rename from tests/v1/test_shell.py rename to manilaclient/tests/unit/v1/test_shell.py index ddc75a22c..73cdad9ea 100644 --- a/tests/v1/test_shell.py +++ b/manilaclient/tests/unit/v1/test_shell.py @@ -25,11 +25,11 @@ from manilaclient import exceptions from manilaclient.openstack.common import cliutils from manilaclient.openstack.common import jsonutils from manilaclient import shell +from manilaclient.tests.unit import utils as test_utils +from manilaclient.tests.unit.v1 import fakes from manilaclient import utils from manilaclient.v1 import client as client_v1 from manilaclient.v1 import shell as shell_v1 -from tests import utils as test_utils -from tests.v1 import fakes class ShellTest(test_utils.TestCase): diff --git a/tests/v1/test_types.py b/manilaclient/tests/unit/v1/test_types.py similarity index 94% rename from tests/v1/test_types.py rename to manilaclient/tests/unit/v1/test_types.py index 9f0c5a5c0..44ca63029 100644 --- a/tests/v1/test_types.py +++ b/manilaclient/tests/unit/v1/test_types.py @@ -11,9 +11,9 @@ # See the License for the specific language governing permissions and # limitations under the License. +from manilaclient.tests.unit import utils +from manilaclient.tests.unit.v1 import fakes from manilaclient.v1 import volume_types -from tests import utils -from tests.v1 import fakes cs = fakes.FakeClient() diff --git a/tests/old/contrib/__init__.py b/tests/old/contrib/__init__.py deleted file mode 100644 index d7ca88098..000000000 --- a/tests/old/contrib/__init__.py +++ /dev/null @@ -1 +0,0 @@ -__author__ = 'vkostenko'