Start using to oslotest

oslotest provides a BaseTestCase class then enables proper capturing of
stdout, stderr and logging streams during a test run. We will take
advantage of this capability in the near future.

Change-Id: I16761053f631e709224eee813dc0f423f06c8870
This commit is contained in:
David Stanek 2014-03-06 15:04:53 +00:00
parent ff88763786
commit a2e08781ce
9 changed files with 16 additions and 18 deletions

View File

@ -26,9 +26,9 @@ import warnings
import fixtures import fixtures
import logging import logging
import oslotest.base as oslotest
from paste import deploy from paste import deploy
import six import six
import testtools
from testtools import testcase from testtools import testcase
import webob import webob
@ -323,7 +323,7 @@ class NoModule(object):
sys.meta_path.insert(0, finder) sys.meta_path.insert(0, finder)
class BaseTestCase(testtools.TestCase): class BaseTestCase(oslotest.BaseTestCase):
"""Light weight base test class. """Light weight base test class.
This is a placeholder that will eventually go away once thc This is a placeholder that will eventually go away once thc

View File

@ -20,10 +20,10 @@ import uuid
from dogpile.cache import api from dogpile.cache import api
from dogpile.cache import region as dp_region from dogpile.cache import region as dp_region
import six import six
import testtools
from keystone.common.cache.backends import mongo from keystone.common.cache.backends import mongo
from keystone import exception from keystone import exception
from keystone import tests
# Mock database structure sample where 'ks_cache' is database and # Mock database structure sample where 'ks_cache' is database and
@ -277,7 +277,7 @@ class MyTransformer(mongo.BaseTransform):
return super(MyTransformer, self).transform_outgoing(son, collection) return super(MyTransformer, self).transform_outgoing(son, collection)
class MongoCache(testtools.TestCase): class MongoCache(tests.BaseTestCase):
def setUp(self): def setUp(self):
super(MongoCache, self).setUp() super(MongoCache, self).setUp()
global COLLECTIONS global COLLECTIONS

View File

@ -12,13 +12,13 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
import testtools
import uuid import uuid
from keystone.common import dependency from keystone.common import dependency
from keystone import tests
class TestDependencyInjection(testtools.TestCase): class TestDependencyInjection(tests.BaseTestCase):
def setUp(self): def setUp(self):
super(TestDependencyInjection, self).setUp() super(TestDependencyInjection, self).setUp()
self.addCleanup(dependency.reset) self.addCleanup(dependency.reset)

View File

@ -14,13 +14,13 @@
import textwrap import textwrap
import testtools
from testtools.tests.matchers import helpers from testtools.tests.matchers import helpers
from keystone import tests
from keystone.tests import matchers from keystone.tests import matchers
class TestXMLEquals(testtools.TestCase, helpers.TestMatchersInterface): class TestXMLEquals(tests.BaseTestCase, helpers.TestMatchersInterface):
matches_xml = """ matches_xml = """
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<test xmlns="http://docs.openstack.org/identity/api/v2.0"> <test xmlns="http://docs.openstack.org/identity/api/v2.0">

View File

@ -12,14 +12,13 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
import testtools
from keystoneclient.middleware import s3_token as ksc_s3_token from keystoneclient.middleware import s3_token as ksc_s3_token
from keystone.middleware import s3_token from keystone.middleware import s3_token
from keystone import tests
class S3TokenMiddlewareTestBase(testtools.TestCase): class S3TokenMiddlewareTestBase(tests.BaseTestCase):
def test_symbols(self): def test_symbols(self):
"""Verify s3_token middleware symbols. """Verify s3_token middleware symbols.

View File

@ -12,9 +12,9 @@
from sqlalchemy.ext import declarative from sqlalchemy.ext import declarative
import testtools
from keystone.common import sql from keystone.common import sql
from keystone import tests
from keystone.tests import utils from keystone.tests import utils
@ -27,7 +27,7 @@ class TestModel(ModelBase, sql.ModelDictMixin):
text = sql.Column(sql.String(64), nullable=False) text = sql.Column(sql.String(64), nullable=False)
class TestModelDictMixin(testtools.TestCase): class TestModelDictMixin(tests.BaseTestCase):
def test_creating_a_model_instance_from_a_dict(self): def test_creating_a_model_instance_from_a_dict(self):
d = {'id': utils.new_uuid(), 'text': utils.new_uuid()} d = {'id': utils.new_uuid(), 'text': utils.new_uuid()}

View File

@ -12,12 +12,11 @@
import uuid import uuid
import testtools
from keystone.common import utils from keystone.common import utils
from keystone import tests
class TestPasswordHashing(testtools.TestCase): class TestPasswordHashing(tests.BaseTestCase):
def setUp(self): def setUp(self):
super(TestPasswordHashing, self).setUp() super(TestPasswordHashing, self).setUp()

View File

@ -16,7 +16,6 @@ import os
import uuid import uuid
import mock import mock
import testtools
from keystone import config from keystone import config
from keystone import exception from keystone import exception
@ -27,7 +26,7 @@ from keystone import tests
CONF = config.CONF CONF = config.CONF
class TestDomainConfigs(testtools.TestCase): class TestDomainConfigs(tests.BaseTestCase):
def setUp(self): def setUp(self):
super(TestDomainConfigs, self).setUp() super(TestDomainConfigs, self).setUp()

View File

@ -21,6 +21,7 @@ fixtures>=0.3.14
# mock object framework # mock object framework
mock>=1.0 mock>=1.0
mox>=0.5.3 mox>=0.5.3
oslotest
# required to build documentation # required to build documentation
sphinx>=1.1.2,<1.2 sphinx>=1.1.2,<1.2
# test wsgi apps without starting an http server # test wsgi apps without starting an http server