From 196daf859b1557fba24dbcf9870d3a834da86916 Mon Sep 17 00:00:00 2001 From: Monty Taylor <mordred@inaugust.com> Date: Sun, 30 Jun 2013 23:01:17 -0400 Subject: [PATCH] Move tests into project package. There are several reasons for this. One is that the majority of OpenStack packages behave this way. The second is that it makes writing software that extends something easier to test (which is a clear usecase for openstackclient) And third, tests/__init__.py implies a global package named "tests" - which I'm pretty sure we're not providing. Change-Id: Ic708ffd92aea78c2ffc1a8579af0587af4fca4ff --- .testr.conf | 2 +- {tests => openstackclient/tests}/__init__.py | 0 {tests => openstackclient/tests}/common/test_clientmanager.py | 2 +- .../tests}/common/test_commandmanager.py | 2 +- {tests => openstackclient/tests}/common/test_parseractions.py | 2 +- {tests => openstackclient/tests}/compute/__init__.py | 0 {tests => openstackclient/tests}/compute/test_compute.py | 4 ++-- {tests => openstackclient/tests}/identity/__init__.py | 0 {tests => openstackclient/tests}/identity/test_identity.py | 4 ++-- {tests => openstackclient/tests}/image/__init__.py | 0 {tests => openstackclient/tests}/image/test_image.py | 4 ++-- {tests => openstackclient/tests}/test_shell.py | 2 +- {tests => openstackclient/tests}/utils.py | 0 {tests => openstackclient/tests}/volume/__init__.py | 0 {tests => openstackclient/tests}/volume/test_volume.py | 4 ++-- 15 files changed, 13 insertions(+), 13 deletions(-) rename {tests => openstackclient/tests}/__init__.py (100%) rename {tests => openstackclient/tests}/common/test_clientmanager.py (96%) rename {tests => openstackclient/tests}/common/test_commandmanager.py (98%) rename {tests => openstackclient/tests}/common/test_parseractions.py (98%) rename {tests => openstackclient/tests}/compute/__init__.py (100%) rename {tests => openstackclient/tests}/compute/test_compute.py (93%) rename {tests => openstackclient/tests}/identity/__init__.py (100%) rename {tests => openstackclient/tests}/identity/test_identity.py (92%) rename {tests => openstackclient/tests}/image/__init__.py (100%) rename {tests => openstackclient/tests}/image/test_image.py (93%) rename {tests => openstackclient/tests}/test_shell.py (99%) rename {tests => openstackclient/tests}/utils.py (100%) rename {tests => openstackclient/tests}/volume/__init__.py (100%) rename {tests => openstackclient/tests}/volume/test_volume.py (93%) diff --git a/.testr.conf b/.testr.conf index 2109af6ce0..d152a5aa93 100644 --- a/.testr.conf +++ b/.testr.conf @@ -1,4 +1,4 @@ [DEFAULT] -test_command=OS_STDOUT_CAPTURE=1 OS_STDERR_CAPTURE=1 ${PYTHON:-python} -m subunit.run discover -t ./ ./tests $LISTOPT $IDOPTION +test_command=OS_STDOUT_CAPTURE=1 OS_STDERR_CAPTURE=1 ${PYTHON:-python} -m subunit.run discover -t ./ . $LISTOPT $IDOPTION test_id_option=--load-list $IDFILE test_list_option=--list diff --git a/tests/__init__.py b/openstackclient/tests/__init__.py similarity index 100% rename from tests/__init__.py rename to openstackclient/tests/__init__.py diff --git a/tests/common/test_clientmanager.py b/openstackclient/tests/common/test_clientmanager.py similarity index 96% rename from tests/common/test_clientmanager.py rename to openstackclient/tests/common/test_clientmanager.py index fe99c599f1..395f6ec33d 100644 --- a/tests/common/test_clientmanager.py +++ b/openstackclient/tests/common/test_clientmanager.py @@ -14,7 +14,7 @@ # from openstackclient.common import clientmanager -from tests import utils +from openstackclient.tests import utils class Container(object): diff --git a/tests/common/test_commandmanager.py b/openstackclient/tests/common/test_commandmanager.py similarity index 98% rename from tests/common/test_commandmanager.py rename to openstackclient/tests/common/test_commandmanager.py index f0a0b3418d..4953c29754 100644 --- a/tests/common/test_commandmanager.py +++ b/openstackclient/tests/common/test_commandmanager.py @@ -16,7 +16,7 @@ import mock from openstackclient.common import commandmanager -from tests import utils +from openstackclient.tests import utils class FakeCommand(object): diff --git a/tests/common/test_parseractions.py b/openstackclient/tests/common/test_parseractions.py similarity index 98% rename from tests/common/test_parseractions.py rename to openstackclient/tests/common/test_parseractions.py index f48c4d721b..705e7e9c36 100644 --- a/tests/common/test_parseractions.py +++ b/openstackclient/tests/common/test_parseractions.py @@ -16,7 +16,7 @@ import argparse from openstackclient.common import parseractions -from tests import utils +from openstackclient.tests import utils class TestKeyValueAction(utils.TestCase): diff --git a/tests/compute/__init__.py b/openstackclient/tests/compute/__init__.py similarity index 100% rename from tests/compute/__init__.py rename to openstackclient/tests/compute/__init__.py diff --git a/tests/compute/test_compute.py b/openstackclient/tests/compute/test_compute.py similarity index 93% rename from tests/compute/test_compute.py rename to openstackclient/tests/compute/test_compute.py index 2673f994c7..9d2061d284 100644 --- a/tests/compute/test_compute.py +++ b/openstackclient/tests/compute/test_compute.py @@ -17,7 +17,7 @@ import mock from openstackclient.common import clientmanager from openstackclient.compute import client as compute_client -from tests import utils +from openstackclient.tests import utils AUTH_TOKEN = "foobar" @@ -37,7 +37,7 @@ class TestCompute(utils.TestCase): api_version = {"compute": "2"} compute_client.API_VERSIONS = { - "2": "tests.compute.test_compute.FakeClient" + "2": "openstackclient.tests.compute.test_compute.FakeClient" } self.cm = clientmanager.ClientManager(token=AUTH_TOKEN, diff --git a/tests/identity/__init__.py b/openstackclient/tests/identity/__init__.py similarity index 100% rename from tests/identity/__init__.py rename to openstackclient/tests/identity/__init__.py diff --git a/tests/identity/test_identity.py b/openstackclient/tests/identity/test_identity.py similarity index 92% rename from tests/identity/test_identity.py rename to openstackclient/tests/identity/test_identity.py index 52bbd22218..04bbd20f49 100644 --- a/tests/identity/test_identity.py +++ b/openstackclient/tests/identity/test_identity.py @@ -15,7 +15,7 @@ from openstackclient.common import clientmanager from openstackclient.identity import client as identity_client -from tests import utils +from openstackclient.tests import utils AUTH_TOKEN = "foobar" @@ -35,7 +35,7 @@ class TestIdentity(utils.TestCase): api_version = {"identity": "2.0"} identity_client.API_VERSIONS = { - "2.0": "tests.identity.test_identity.FakeClient" + "2.0": "openstackclient.tests.identity.test_identity.FakeClient" } self.cm = clientmanager.ClientManager(token=AUTH_TOKEN, diff --git a/tests/image/__init__.py b/openstackclient/tests/image/__init__.py similarity index 100% rename from tests/image/__init__.py rename to openstackclient/tests/image/__init__.py diff --git a/tests/image/test_image.py b/openstackclient/tests/image/test_image.py similarity index 93% rename from tests/image/test_image.py rename to openstackclient/tests/image/test_image.py index 60b2142943..f4c8d72e37 100644 --- a/tests/image/test_image.py +++ b/openstackclient/tests/image/test_image.py @@ -17,7 +17,7 @@ import mock from openstackclient.common import clientmanager from openstackclient.image import client as image_client -from tests import utils +from openstackclient.tests import utils AUTH_TOKEN = "foobar" @@ -38,7 +38,7 @@ class TestImage(utils.TestCase): api_version = {"image": "2"} image_client.API_VERSIONS = { - "2": "tests.image.test_image.FakeClient" + "2": "openstackclient.tests.image.test_image.FakeClient" } self.cm = clientmanager.ClientManager(token=AUTH_TOKEN, diff --git a/tests/test_shell.py b/openstackclient/tests/test_shell.py similarity index 99% rename from tests/test_shell.py rename to openstackclient/tests/test_shell.py index d0eb5b0d39..f479b11e4b 100644 --- a/tests/test_shell.py +++ b/openstackclient/tests/test_shell.py @@ -17,7 +17,7 @@ import mock import os from openstackclient import shell -from tests import utils +from openstackclient.tests import utils DEFAULT_USERNAME = "username" diff --git a/tests/utils.py b/openstackclient/tests/utils.py similarity index 100% rename from tests/utils.py rename to openstackclient/tests/utils.py diff --git a/tests/volume/__init__.py b/openstackclient/tests/volume/__init__.py similarity index 100% rename from tests/volume/__init__.py rename to openstackclient/tests/volume/__init__.py diff --git a/tests/volume/test_volume.py b/openstackclient/tests/volume/test_volume.py similarity index 93% rename from tests/volume/test_volume.py rename to openstackclient/tests/volume/test_volume.py index 8c60dd1242..548fbf7413 100644 --- a/tests/volume/test_volume.py +++ b/openstackclient/tests/volume/test_volume.py @@ -16,8 +16,8 @@ import mock from openstackclient.common import clientmanager +from openstackclient.tests import utils from openstackclient.volume import client as volume_client -from tests import utils AUTH_TOKEN = "foobar" @@ -38,7 +38,7 @@ class TestVolume(utils.TestCase): api_version = {"volume": "1"} volume_client.API_VERSIONS = { - "1": "tests.volume.test_volume.FakeClient" + "1": "openstackclient.tests.volume.test_volume.FakeClient" } self.cm = clientmanager.ClientManager(token=AUTH_TOKEN,