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:
Flaper Fesp 2013-08-29 17:03:22 +02:00
parent 9e5754695d
commit 85e0c2cd22
36 changed files with 27 additions and 95 deletions

View File

@ -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'))

View File

@ -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.

View File

@ -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

View File

@ -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")

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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):

View File

@ -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):

View File

View File

@ -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):

View File

@ -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

View File

@ -16,7 +16,7 @@
import falcon
from marconi.tests.transport.wsgi import base
import base # noqa
class TestHealth(base.TestBase):

View File

@ -18,7 +18,7 @@ import json
import falcon
from marconi.tests.transport.wsgi import base
import base # noqa
class TestHomeDocument(base.TestBase):

View File

@ -17,7 +17,7 @@ import ddt
import falcon
from falcon import testing
from marconi.tests.transport.wsgi import base
import base # noqa
@ddt.ddt

View File

@ -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

View File

@ -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

View File

@ -17,7 +17,7 @@ import json
import falcon
from marconi.tests.transport.wsgi import base
import base # noqa
class ValidationTest(base.TestBase):