summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDoug Hellmann <doug.hellmann@dreamhost.com>2014-04-29 12:23:11 -0700
committerDoug Hellmann <doug.hellmann@dreamhost.com>2014-04-29 12:23:11 -0700
commit39e01ea9f14691cfce24b6d2ea7534116c47af9d (patch)
tree76f650535309c19f2f13c35be368395216568b24
parentb468f9ffba97f2cd59828123f11a0e1e54127395 (diff)
downloadoslo-i18n-39e01ea9f14691cfce24b6d2ea7534116c47af9d.tar.gz
Make unit tests pass
Update test requirements. Move unit test modules into the right place. A few small changes to the test code. Change-Id: I5f118d753de467eed822cf264ab68b911aa7f2fb
-rw-r--r--test-requirements.txt9
-rw-r--r--tests/base.py54
-rw-r--r--tests/fakes.py (renamed from tests/unit/fakes.py)17
-rw-r--r--tests/test_gettextutils.py (renamed from tests/unit/test_gettext.py)9
-rw-r--r--tests/test_i18n.py28
5 files changed, 7 insertions, 110 deletions
diff --git a/test-requirements.txt b/test-requirements.txt
index 2a46bd8..34b5dc4 100644
--- a/test-requirements.txt
+++ b/test-requirements.txt
@@ -1,11 +1,6 @@
hacking>=0.5.6,<0.8
-coverage>=3.6
-discover
-fixtures>=0.3.14
-python-subunit
sphinx>=1.1.2
oslosphinx
-testrepository>=0.0.17
-testscenarios>=0.4,<0.5
-testtools>=0.9.32 \ No newline at end of file
+
+oslotest
diff --git a/tests/base.py b/tests/base.py
deleted file mode 100644
index f9a09a8..0000000
--- a/tests/base.py
+++ /dev/null
@@ -1,54 +0,0 @@
-# -*- coding: utf-8 -*-
-
-# Copyright 2010-2011 OpenStack Foundation
-# Copyright (c) 2013 Hewlett-Packard Development Company, L.P.
-#
-# 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.
-
-import os
-
-import fixtures
-import testtools
-
-_TRUE_VALUES = ('true', '1', 'yes')
-
-# FIXME(dhellmann) Update this to use oslo.test library
-
-class TestCase(testtools.TestCase):
-
- """Test case base class for all unit tests."""
-
- def setUp(self):
- """Run before each test method to initialize test environment."""
-
- super(TestCase, self).setUp()
- test_timeout = os.environ.get('OS_TEST_TIMEOUT', 0)
- try:
- test_timeout = int(test_timeout)
- except ValueError:
- # If timeout value is invalid do not set a timeout.
- test_timeout = 0
- if test_timeout > 0:
- self.useFixture(fixtures.Timeout(test_timeout, gentle=True))
-
- self.useFixture(fixtures.NestedTempfile())
- self.useFixture(fixtures.TempHomeDir())
-
- if os.environ.get('OS_STDOUT_CAPTURE') in _TRUE_VALUES:
- stdout = self.useFixture(fixtures.StringStream('stdout')).stream
- self.useFixture(fixtures.MonkeyPatch('sys.stdout', stdout))
- if os.environ.get('OS_STDERR_CAPTURE') in _TRUE_VALUES:
- stderr = self.useFixture(fixtures.StringStream('stderr')).stream
- self.useFixture(fixtures.MonkeyPatch('sys.stderr', stderr))
-
- self.log_fixture = self.useFixture(fixtures.FakeLogger()) \ No newline at end of file
diff --git a/tests/unit/fakes.py b/tests/fakes.py
index eab0d88..8561d6b 100644
--- a/tests/unit/fakes.py
+++ b/tests/fakes.py
@@ -19,23 +19,6 @@ Fakes For filter and weight tests.
import gettext
-from openstack.common.scheduler import weights
-
-
-class FakeWeigher1(weights.BaseHostWeigher):
- def __init__(self):
- pass
-
-
-class FakeWeigher2(weights.BaseHostWeigher):
- def __init__(self):
- pass
-
-
-class FakeClass(object):
- def __init__(self):
- pass
-
class FakeTranslations(gettext.GNUTranslations):
"""A test GNUTranslations class that takes a map of msg -> translations."""
diff --git a/tests/unit/test_gettext.py b/tests/test_gettextutils.py
index c9c1013..f7ebc46 100644
--- a/tests/unit/test_gettext.py
+++ b/tests/test_gettextutils.py
@@ -17,15 +17,16 @@
import gettext
import logging
+from oslo.i18n import gettextutils
+
from babel import localedata
import mock
-from oslotest import base as test_base
import six
import testtools
-from openstack.common.fixture import moxstubout
-from openstack.common import gettextutils
-from tests.unit import fakes
+from oslotest import base as test_base
+from oslotest import moxstubout
+from tests import fakes
LOG = logging.getLogger(__name__)
diff --git a/tests/test_i18n.py b/tests/test_i18n.py
deleted file mode 100644
index 4fda530..0000000
--- a/tests/test_i18n.py
+++ /dev/null
@@ -1,28 +0,0 @@
-# -*- coding: utf-8 -*-
-
-# 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.
-
-"""
-test_i18n
-----------------------------------
-
-Tests for `i18n` module.
-"""
-
-from . import base
-
-
-class TestI18n(base.TestCase):
-
- def test_something(self):
- pass \ No newline at end of file