diff --git a/marconi/tests/common/test_decorators.py b/marconi/tests/common/test_decorators.py deleted file mode 100644 index 38eb0370d..000000000 --- a/marconi/tests/common/test_decorators.py +++ /dev/null @@ -1,77 +0,0 @@ -# Copyright (c) 2013 Red Hat, Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or -# implied. -# See the License for the specific language governing permissions and -# limitations under the License. - - -from marconi.common import decorators -from marconi.tests import util as testing - - -class TestLazyProperty(testing.TestBase): - - class DecoratedClass(object): - - @decorators.lazy_property(write=True) - def read_write_delete(self): - return True - - @decorators.lazy_property(write=True, delete=False) - def read_write(self): - return True - - @decorators.lazy_property() - def read_delete(self): - return True - - def setUp(self): - super(TestLazyProperty, self).setUp() - self.cls_instance = self.DecoratedClass() - - def test_write_delete(self): - self.assertTrue(self.cls_instance.read_write_delete) - self.assertTrue(hasattr(self.cls_instance, '_lazy_read_write_delete')) - - self.cls_instance.read_write_delete = False - self.assertFalse(self.cls_instance.read_write_delete) - - del self.cls_instance.read_write_delete - self.assertFalse(hasattr(self.cls_instance, '_lazy_read_write_delete')) - - def test_write(self): - self.assertTrue(self.cls_instance.read_write) - self.assertTrue(hasattr(self.cls_instance, '_lazy_read_write')) - - self.cls_instance.read_write = False - self.assertFalse(self.cls_instance.read_write) - - try: - del self.cls_instance.read_write - self.fail() - except TypeError: - # Bool object is not callable - self.assertTrue(hasattr(self.cls_instance, '_lazy_read_write')) - - def test_delete(self): - self.assertTrue(self.cls_instance.read_delete) - self.assertTrue(hasattr(self.cls_instance, '_lazy_read_delete')) - - try: - self.cls_instance.read_delete = False - self.fail() - except TypeError: - # Bool object is not callable - pass - - del self.cls_instance.read_delete - self.assertFalse(hasattr(self.cls_instance, '_lazy_read_delete')) diff --git a/marconi/tests/util/base.py b/marconi/tests/util/base.py index f5c0e387c..e181a8159 100644 --- a/marconi/tests/util/base.py +++ b/marconi/tests/util/base.py @@ -46,9 +46,7 @@ class TestBase(testtools.TestCase): :param filename: Name of the conf file to find (e.g., 'wsgi_memory.conf') """ - - parent = os.path.dirname(self._my_dir()) - return os.path.join(parent, 'etc', filename) + return os.path.join(os.environ["MARCONI_TESTS_CONFIGS_DIR"], filename) def load_conf(self, filename): """Loads `filename` configuration file. diff --git a/setup.cfg b/setup.cfg index 81a2f789c..adaa7b451 100644 --- a/setup.cfg +++ b/setup.cfg @@ -42,9 +42,9 @@ marconi.common.cache.backends = memcached = marconi.common.cache._backends.memcached:MemcachedBackend [nosetests] -where=marconi/tests +where=tests verbosity=2 -exclude=system/* +exclude=functional/* with-doctest = true diff --git a/marconi/tests/common/__init__.py b/tests/__init__.py similarity index 66% rename from marconi/tests/common/__init__.py rename to tests/__init__.py index cc355f6f5..99252f86f 100644 --- a/marconi/tests/common/__init__.py +++ b/tests/__init__.py @@ -11,3 +11,12 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or # implied. # See the License for the specific language governing permissions and +# limitations under the License. + +import os + +tests_dir = os.path.abspath(os.path.dirname(__file__)) +os.environ.setdefault("MARCONI_TESTS_DIR", tests_dir) + +if "MARCONI_TESTS_CONFIGS_DIR" not in os.environ: + os.environ["MARCONI_TESTS_CONFIGS_DIR"] = os.path.join(tests_dir, "etc") diff --git a/marconi/tests/etc/drivers_storage_invalid.conf b/tests/etc/drivers_storage_invalid.conf similarity index 100% rename from marconi/tests/etc/drivers_storage_invalid.conf rename to tests/etc/drivers_storage_invalid.conf diff --git a/marconi/tests/etc/drivers_transport_invalid.conf b/tests/etc/drivers_transport_invalid.conf similarity index 100% rename from marconi/tests/etc/drivers_transport_invalid.conf rename to tests/etc/drivers_transport_invalid.conf diff --git a/marconi/tests/etc/functional-tests.conf-sample b/tests/etc/functional-tests.conf similarity index 100% rename from marconi/tests/etc/functional-tests.conf-sample rename to tests/etc/functional-tests.conf diff --git a/marconi/tests/etc/keystone_auth.conf b/tests/etc/keystone_auth.conf similarity index 100% rename from marconi/tests/etc/keystone_auth.conf rename to tests/etc/keystone_auth.conf diff --git a/marconi/tests/etc/wsgi_faulty.conf b/tests/etc/wsgi_faulty.conf similarity index 100% rename from marconi/tests/etc/wsgi_faulty.conf rename to tests/etc/wsgi_faulty.conf diff --git a/marconi/tests/etc/wsgi_mongodb.conf b/tests/etc/wsgi_mongodb.conf similarity index 100% rename from marconi/tests/etc/wsgi_mongodb.conf rename to tests/etc/wsgi_mongodb.conf diff --git a/marconi/tests/etc/wsgi_sqlite.conf b/tests/etc/wsgi_sqlite.conf similarity index 100% rename from marconi/tests/etc/wsgi_sqlite.conf rename to tests/etc/wsgi_sqlite.conf diff --git a/marconi/tests/etc/wsgi_sqlite_validation.conf b/tests/etc/wsgi_sqlite_validation.conf similarity index 100% rename from marconi/tests/etc/wsgi_sqlite_validation.conf rename to tests/etc/wsgi_sqlite_validation.conf diff --git a/marconi/tests/functional/README.rst b/tests/functional/README.rst similarity index 100% rename from marconi/tests/functional/README.rst rename to tests/functional/README.rst diff --git a/marconi/tests/storage/__init__.py b/tests/functional/__init__.py similarity index 100% rename from marconi/tests/storage/__init__.py rename to tests/functional/__init__.py diff --git a/marconi/tests/functional/test_claims.py b/tests/functional/test_claims.py similarity index 99% rename from marconi/tests/functional/test_claims.py rename to tests/functional/test_claims.py index fec567f63..411d36ead 100644 --- a/marconi/tests/functional/test_claims.py +++ b/tests/functional/test_claims.py @@ -12,7 +12,7 @@ # implied. # See the License for the specific language governing permissions and # limitations under the License. -from marconi.tests.functional.util import base +from marconi.tests.functional.util import base # noqa from marconi.tests.functional.util import config from marconi.tests.functional.util import helpers from marconi.tests.functional.util import http diff --git a/marconi/tests/functional/test_messages.py b/tests/functional/test_messages.py similarity index 99% rename from marconi/tests/functional/test_messages.py rename to tests/functional/test_messages.py index da54fcd93..e9c4ebd8c 100644 --- a/marconi/tests/functional/test_messages.py +++ b/tests/functional/test_messages.py @@ -12,7 +12,7 @@ # implied. # See the License for the specific language governing permissions and # limitations under the License. -from marconi.tests.functional.util import base +from marconi.tests.functional.util import base # noqa from marconi.tests.functional.util import config from marconi.tests.functional.util import helpers from marconi.tests.functional.util import http diff --git a/marconi/tests/functional/test_queue.py b/tests/functional/test_queue.py similarity index 99% rename from marconi/tests/functional/test_queue.py rename to tests/functional/test_queue.py index 497e8f809..4eb08fdf0 100644 --- a/marconi/tests/functional/test_queue.py +++ b/tests/functional/test_queue.py @@ -13,7 +13,7 @@ # implied. # See the License for the specific language governing permissions and # limitations under the License. -from marconi.tests.functional.util import base +from marconi.tests.functional.util import base # noqa from marconi.tests.functional.util import config from marconi.tests.functional.util import helpers from marconi.tests.functional.util import http diff --git a/marconi/tests/transport/__init__.py b/tests/storage/__init__.py similarity index 100% rename from marconi/tests/transport/__init__.py rename to tests/storage/__init__.py diff --git a/marconi/tests/storage/base.py b/tests/storage/base.py similarity index 100% rename from marconi/tests/storage/base.py rename to tests/storage/base.py diff --git a/marconi/tests/storage/test_impl_mongodb.py b/tests/storage/test_impl_mongodb.py similarity index 99% rename from marconi/tests/storage/test_impl_mongodb.py rename to tests/storage/test_impl_mongodb.py index cbf0259df..575362268 100644 --- a/marconi/tests/storage/test_impl_mongodb.py +++ b/tests/storage/test_impl_mongodb.py @@ -28,9 +28,10 @@ from marconi.storage import mongodb from marconi.storage.mongodb import controllers from marconi.storage.mongodb import options as mongodb_options from marconi.storage.mongodb import utils -from marconi.tests.storage import base from marconi.tests import util as testing +import base # noqa # noqa + class MongodbUtilsTest(testing.TestBase): diff --git a/marconi/tests/storage/test_impl_sqlite.py b/tests/storage/test_impl_sqlite.py similarity index 97% rename from marconi/tests/storage/test_impl_sqlite.py rename to tests/storage/test_impl_sqlite.py index ec6115933..9cd0dd0a2 100644 --- a/marconi/tests/storage/test_impl_sqlite.py +++ b/tests/storage/test_impl_sqlite.py @@ -16,7 +16,8 @@ from marconi import storage from marconi.storage import sqlite from marconi.storage.sqlite import controllers -from marconi.tests.storage import base + +import base # noqa class SQliteQueueTests(base.QueueControllerTest): diff --git a/marconi/tests/test_bootstrap.py b/tests/test_bootstrap.py similarity index 100% rename from marconi/tests/test_bootstrap.py rename to tests/test_bootstrap.py diff --git a/marconi/tests/test_config.py b/tests/test_config.py similarity index 100% rename from marconi/tests/test_config.py rename to tests/test_config.py diff --git a/marconi/tests/transport/wsgi/__init__.py b/tests/transport/__init__.py similarity index 100% rename from marconi/tests/transport/wsgi/__init__.py rename to tests/transport/__init__.py diff --git a/marconi/tests/transport/test_auth.py b/tests/transport/test_auth.py similarity index 100% rename from marconi/tests/transport/test_auth.py rename to tests/transport/test_auth.py diff --git a/tests/transport/wsgi/__init__.py b/tests/transport/wsgi/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/marconi/tests/transport/wsgi/base.py b/tests/transport/wsgi/base.py similarity index 100% rename from marconi/tests/transport/wsgi/base.py rename to tests/transport/wsgi/base.py diff --git a/marconi/tests/transport/wsgi/test_auth.py b/tests/transport/wsgi/test_auth.py similarity index 96% rename from marconi/tests/transport/wsgi/test_auth.py rename to tests/transport/wsgi/test_auth.py index c6ee5d325..7068c99ac 100644 --- a/marconi/tests/transport/wsgi/test_auth.py +++ b/tests/transport/wsgi/test_auth.py @@ -18,7 +18,7 @@ import falcon from falcon import testing from keystoneclient.middleware import auth_token -from marconi.tests.transport.wsgi import base +import base # noqa class TestWSGIAuth(base.TestBase): diff --git a/marconi/tests/transport/wsgi/test_claims.py b/tests/transport/wsgi/test_claims.py similarity index 99% rename from marconi/tests/transport/wsgi/test_claims.py rename to tests/transport/wsgi/test_claims.py index 80d56f130..50d15800a 100644 --- a/marconi/tests/transport/wsgi/test_claims.py +++ b/tests/transport/wsgi/test_claims.py @@ -21,9 +21,9 @@ import pymongo import ddt import falcon +import base # noqa from marconi.common import config from marconi.openstack.common import timeutils -from marconi.tests.transport.wsgi import base @ddt.ddt diff --git a/marconi/tests/transport/wsgi/test_health.py b/tests/transport/wsgi/test_health.py similarity index 95% rename from marconi/tests/transport/wsgi/test_health.py rename to tests/transport/wsgi/test_health.py index dc2dd5fa7..70e90ee9d 100644 --- a/marconi/tests/transport/wsgi/test_health.py +++ b/tests/transport/wsgi/test_health.py @@ -16,7 +16,7 @@ import falcon -from marconi.tests.transport.wsgi import base +import base # noqa class TestHealth(base.TestBase): diff --git a/marconi/tests/transport/wsgi/test_home.py b/tests/transport/wsgi/test_home.py similarity index 95% rename from marconi/tests/transport/wsgi/test_home.py rename to tests/transport/wsgi/test_home.py index bf5522b52..547b7bcee 100644 --- a/marconi/tests/transport/wsgi/test_home.py +++ b/tests/transport/wsgi/test_home.py @@ -18,7 +18,7 @@ import json import falcon -from marconi.tests.transport.wsgi import base +import base # noqa class TestHomeDocument(base.TestBase): diff --git a/marconi/tests/transport/wsgi/test_media_type.py b/tests/transport/wsgi/test_media_type.py similarity index 97% rename from marconi/tests/transport/wsgi/test_media_type.py rename to tests/transport/wsgi/test_media_type.py index 348ded3b4..212763ae2 100644 --- a/marconi/tests/transport/wsgi/test_media_type.py +++ b/tests/transport/wsgi/test_media_type.py @@ -17,7 +17,7 @@ import ddt import falcon from falcon import testing -from marconi.tests.transport.wsgi import base +import base # noqa @ddt.ddt diff --git a/marconi/tests/transport/wsgi/test_messages.py b/tests/transport/wsgi/test_messages.py similarity index 99% rename from marconi/tests/transport/wsgi/test_messages.py rename to tests/transport/wsgi/test_messages.py index 74f1de55c..d04dba21e 100644 --- a/marconi/tests/transport/wsgi/test_messages.py +++ b/tests/transport/wsgi/test_messages.py @@ -20,8 +20,8 @@ import ddt import falcon from testtools import matchers +import base # noqa from marconi.common import config -from marconi.tests.transport.wsgi import base @ddt.ddt diff --git a/marconi/tests/transport/wsgi/test_queue_lifecycle.py b/tests/transport/wsgi/test_queue_lifecycle.py similarity index 99% rename from marconi/tests/transport/wsgi/test_queue_lifecycle.py rename to tests/transport/wsgi/test_queue_lifecycle.py index 9e07811db..42a213db2 100644 --- a/marconi/tests/transport/wsgi/test_queue_lifecycle.py +++ b/tests/transport/wsgi/test_queue_lifecycle.py @@ -21,8 +21,8 @@ import ddt import falcon import pymongo +import base # noqa from marconi.common import config -from marconi.tests.transport.wsgi import base @ddt.ddt diff --git a/marconi/tests/transport/wsgi/test_utils.py b/tests/transport/wsgi/test_utils.py similarity index 100% rename from marconi/tests/transport/wsgi/test_utils.py rename to tests/transport/wsgi/test_utils.py diff --git a/marconi/tests/transport/wsgi/test_validation.py b/tests/transport/wsgi/test_validation.py similarity index 98% rename from marconi/tests/transport/wsgi/test_validation.py rename to tests/transport/wsgi/test_validation.py index a87d118a5..1266d7a2e 100644 --- a/marconi/tests/transport/wsgi/test_validation.py +++ b/tests/transport/wsgi/test_validation.py @@ -17,7 +17,7 @@ import json import falcon -from marconi.tests.transport.wsgi import base +import base # noqa class ValidationTest(base.TestBase):