summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--nova/tests/api/openstack/compute/test_limits.py20
-rw-r--r--nova/tests/test_compat_flagfile.py10
2 files changed, 10 insertions, 20 deletions
diff --git a/nova/tests/api/openstack/compute/test_limits.py b/nova/tests/api/openstack/compute/test_limits.py
index a743903df..496acf0b0 100644
--- a/nova/tests/api/openstack/compute/test_limits.py
+++ b/nova/tests/api/openstack/compute/test_limits.py
@@ -48,13 +48,12 @@ NS = {
}
-class BaseLimitTestSuite(unittest.TestCase):
+class BaseLimitTestSuite(test.TestCase):
"""Base test suite which provides relevant stubs and time abstraction."""
def setUp(self):
- """Run before each test."""
+ super(BaseLimitTestSuite, self).setUp()
self.time = 0.0
- self.stubs = stubout.StubOutForTesting()
self.stubs.Set(limits.Limit, "_get_time", self._get_time)
self.absolute_limits = {}
@@ -64,10 +63,6 @@ class BaseLimitTestSuite(unittest.TestCase):
self.stubs.Set(nova.quota, "get_project_quotas",
stub_get_project_quotas)
- def tearDown(self):
- """Run after each test."""
- self.stubs.UnsetAll()
-
def _get_time(self):
"""Return the "time" according to this test suite."""
return self.time
@@ -80,7 +75,7 @@ class LimitsControllerTest(BaseLimitTestSuite):
def setUp(self):
"""Run before each test."""
- BaseLimitTestSuite.setUp(self)
+ super(LimitsControllerTest, self).setUp()
self.controller = limits.create_resource()
def _get_index_request(self, accept_header="application/json"):
@@ -288,7 +283,7 @@ class LimitMiddlewareTest(BaseLimitTestSuite):
def setUp(self):
"""Prepare middleware for use through fake WSGI app."""
- BaseLimitTestSuite.setUp(self)
+ super(LimitMiddlewareTest, self).setUp()
_limits = '(GET, *, .*, 1, MINUTE)'
self.app = limits.RateLimitingMiddleware(self._empty_app, _limits,
"%s.TestLimiter" %
@@ -449,7 +444,7 @@ class LimiterTest(BaseLimitTestSuite):
def setUp(self):
"""Run before each test."""
- BaseLimitTestSuite.setUp(self)
+ super(LimiterTest, self).setUp()
userlimits = {'user:user3': ''}
self.limiter = limits.Limiter(TEST_LIMITS, **userlimits)
@@ -603,7 +598,7 @@ class WsgiLimiterTest(BaseLimitTestSuite):
def setUp(self):
"""Run before each test."""
- BaseLimitTestSuite.setUp(self)
+ super(WsgiLimiterTest, self).setUp()
self.app = limits.WsgiLimiter(TEST_LIMITS)
def _request_data(self, verb, path):
@@ -761,7 +756,7 @@ class WsgiLimiterProxyTest(BaseLimitTestSuite):
Do some nifty HTTP/WSGI magic which allows for WSGI to be called
directly by something like the `httplib` library.
"""
- BaseLimitTestSuite.setUp(self)
+ super(WsgiLimiterProxyTest, self).setUp()
self.app = limits.WsgiLimiter(TEST_LIMITS)
wire_HTTPConnection_to_WSGI("169.254.0.1:80", self.app)
self.proxy = limits.WsgiLimiterProxy("169.254.0.1:80")
@@ -786,7 +781,6 @@ class WsgiLimiterProxyTest(BaseLimitTestSuite):
class LimitsViewBuilderTest(test.TestCase):
-
def setUp(self):
super(LimitsViewBuilderTest, self).setUp()
self.view_builder = views.limits.ViewBuilder()
diff --git a/nova/tests/test_compat_flagfile.py b/nova/tests/test_compat_flagfile.py
index 1635e8322..8ad9f8c75 100644
--- a/nova/tests/test_compat_flagfile.py
+++ b/nova/tests/test_compat_flagfile.py
@@ -25,10 +25,10 @@ import unittest
import uuid
from nova.compat import flagfile
+from nova import test
class ThatLastTwoPercentCoverageTestCase(unittest.TestCase):
-
def test_open_file_for_reading(self):
with flagfile._open_file_for_reading(__file__):
pass
@@ -42,10 +42,9 @@ class ThatLastTwoPercentCoverageTestCase(unittest.TestCase):
os.remove(path)
-class CompatFlagfileTestCase(unittest.TestCase):
-
+class CompatFlagfileTestCase(test.TestCase):
def setUp(self):
- self.stubs = stubout.StubOutForTesting()
+ super(CompatFlagfileTestCase, self).setUp()
self.files = {}
self.tempdir = str(uuid.uuid4())
self.tempfiles = []
@@ -56,9 +55,6 @@ class CompatFlagfileTestCase(unittest.TestCase):
self.stubs.Set(tempfile, 'mkstemp', self._fake_mkstemp)
self.stubs.Set(shutil, 'rmtree', self._fake_rmtree)
- def tearDown(self):
- self.stubs.UnsetAll()
-
def _fake_open(self, *args):
@contextlib.contextmanager
def managed_stringio(path):