Pull actual tests out of marconi/tests
As part of Marconi's test refactoring, it was decided to pull actual tests - those run by nosetest - out of marconi/tests and leave there just the base implementations. The main reasoning about this is to improve tests structure and make packaging easier. blueprint refactor-system-tests Change-Id: Ia7f9192a2ec2c224e78bddb8414d226cb23a929f
This commit is contained in:
parent
9e5754695d
commit
85e0c2cd22
@ -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'))
|
|
@ -46,9 +46,7 @@ class TestBase(testtools.TestCase):
|
|||||||
:param filename: Name of the conf file to find (e.g.,
|
:param filename: Name of the conf file to find (e.g.,
|
||||||
'wsgi_memory.conf')
|
'wsgi_memory.conf')
|
||||||
"""
|
"""
|
||||||
|
return os.path.join(os.environ["MARCONI_TESTS_CONFIGS_DIR"], filename)
|
||||||
parent = os.path.dirname(self._my_dir())
|
|
||||||
return os.path.join(parent, 'etc', filename)
|
|
||||||
|
|
||||||
def load_conf(self, filename):
|
def load_conf(self, filename):
|
||||||
"""Loads `filename` configuration file.
|
"""Loads `filename` configuration file.
|
||||||
|
@ -42,9 +42,9 @@ marconi.common.cache.backends =
|
|||||||
memcached = marconi.common.cache._backends.memcached:MemcachedBackend
|
memcached = marconi.common.cache._backends.memcached:MemcachedBackend
|
||||||
|
|
||||||
[nosetests]
|
[nosetests]
|
||||||
where=marconi/tests
|
where=tests
|
||||||
verbosity=2
|
verbosity=2
|
||||||
exclude=system/*
|
exclude=functional/*
|
||||||
|
|
||||||
with-doctest = true
|
with-doctest = true
|
||||||
|
|
||||||
|
@ -11,3 +11,12 @@
|
|||||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||||
# implied.
|
# implied.
|
||||||
# See the License for the specific language governing permissions and
|
# 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")
|
@ -12,7 +12,7 @@
|
|||||||
# implied.
|
# implied.
|
||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# 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 config
|
||||||
from marconi.tests.functional.util import helpers
|
from marconi.tests.functional.util import helpers
|
||||||
from marconi.tests.functional.util import http
|
from marconi.tests.functional.util import http
|
@ -12,7 +12,7 @@
|
|||||||
# implied.
|
# implied.
|
||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# 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 config
|
||||||
from marconi.tests.functional.util import helpers
|
from marconi.tests.functional.util import helpers
|
||||||
from marconi.tests.functional.util import http
|
from marconi.tests.functional.util import http
|
@ -13,7 +13,7 @@
|
|||||||
# implied.
|
# implied.
|
||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# 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 config
|
||||||
from marconi.tests.functional.util import helpers
|
from marconi.tests.functional.util import helpers
|
||||||
from marconi.tests.functional.util import http
|
from marconi.tests.functional.util import http
|
@ -28,9 +28,10 @@ from marconi.storage import mongodb
|
|||||||
from marconi.storage.mongodb import controllers
|
from marconi.storage.mongodb import controllers
|
||||||
from marconi.storage.mongodb import options as mongodb_options
|
from marconi.storage.mongodb import options as mongodb_options
|
||||||
from marconi.storage.mongodb import utils
|
from marconi.storage.mongodb import utils
|
||||||
from marconi.tests.storage import base
|
|
||||||
from marconi.tests import util as testing
|
from marconi.tests import util as testing
|
||||||
|
|
||||||
|
import base # noqa # noqa
|
||||||
|
|
||||||
|
|
||||||
class MongodbUtilsTest(testing.TestBase):
|
class MongodbUtilsTest(testing.TestBase):
|
||||||
|
|
@ -16,7 +16,8 @@
|
|||||||
from marconi import storage
|
from marconi import storage
|
||||||
from marconi.storage import sqlite
|
from marconi.storage import sqlite
|
||||||
from marconi.storage.sqlite import controllers
|
from marconi.storage.sqlite import controllers
|
||||||
from marconi.tests.storage import base
|
|
||||||
|
import base # noqa
|
||||||
|
|
||||||
|
|
||||||
class SQliteQueueTests(base.QueueControllerTest):
|
class SQliteQueueTests(base.QueueControllerTest):
|
0
tests/transport/wsgi/__init__.py
Normal file
0
tests/transport/wsgi/__init__.py
Normal file
@ -18,7 +18,7 @@ import falcon
|
|||||||
from falcon import testing
|
from falcon import testing
|
||||||
from keystoneclient.middleware import auth_token
|
from keystoneclient.middleware import auth_token
|
||||||
|
|
||||||
from marconi.tests.transport.wsgi import base
|
import base # noqa
|
||||||
|
|
||||||
|
|
||||||
class TestWSGIAuth(base.TestBase):
|
class TestWSGIAuth(base.TestBase):
|
@ -21,9 +21,9 @@ import pymongo
|
|||||||
import ddt
|
import ddt
|
||||||
import falcon
|
import falcon
|
||||||
|
|
||||||
|
import base # noqa
|
||||||
from marconi.common import config
|
from marconi.common import config
|
||||||
from marconi.openstack.common import timeutils
|
from marconi.openstack.common import timeutils
|
||||||
from marconi.tests.transport.wsgi import base
|
|
||||||
|
|
||||||
|
|
||||||
@ddt.ddt
|
@ddt.ddt
|
@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
import falcon
|
import falcon
|
||||||
|
|
||||||
from marconi.tests.transport.wsgi import base
|
import base # noqa
|
||||||
|
|
||||||
|
|
||||||
class TestHealth(base.TestBase):
|
class TestHealth(base.TestBase):
|
@ -18,7 +18,7 @@ import json
|
|||||||
|
|
||||||
import falcon
|
import falcon
|
||||||
|
|
||||||
from marconi.tests.transport.wsgi import base
|
import base # noqa
|
||||||
|
|
||||||
|
|
||||||
class TestHomeDocument(base.TestBase):
|
class TestHomeDocument(base.TestBase):
|
@ -17,7 +17,7 @@ import ddt
|
|||||||
import falcon
|
import falcon
|
||||||
from falcon import testing
|
from falcon import testing
|
||||||
|
|
||||||
from marconi.tests.transport.wsgi import base
|
import base # noqa
|
||||||
|
|
||||||
|
|
||||||
@ddt.ddt
|
@ddt.ddt
|
@ -20,8 +20,8 @@ import ddt
|
|||||||
import falcon
|
import falcon
|
||||||
from testtools import matchers
|
from testtools import matchers
|
||||||
|
|
||||||
|
import base # noqa
|
||||||
from marconi.common import config
|
from marconi.common import config
|
||||||
from marconi.tests.transport.wsgi import base
|
|
||||||
|
|
||||||
|
|
||||||
@ddt.ddt
|
@ddt.ddt
|
@ -21,8 +21,8 @@ import ddt
|
|||||||
import falcon
|
import falcon
|
||||||
import pymongo
|
import pymongo
|
||||||
|
|
||||||
|
import base # noqa
|
||||||
from marconi.common import config
|
from marconi.common import config
|
||||||
from marconi.tests.transport.wsgi import base
|
|
||||||
|
|
||||||
|
|
||||||
@ddt.ddt
|
@ddt.ddt
|
@ -17,7 +17,7 @@ import json
|
|||||||
|
|
||||||
import falcon
|
import falcon
|
||||||
|
|
||||||
from marconi.tests.transport.wsgi import base
|
import base # noqa
|
||||||
|
|
||||||
|
|
||||||
class ValidationTest(base.TestBase):
|
class ValidationTest(base.TestBase):
|
Loading…
Reference in New Issue
Block a user