summaryrefslogtreecommitdiffstats
path: root/tests/utils.py
diff options
context:
space:
mode:
authorMonty Taylor <mordred@inaugust.com>2013-01-22 19:54:57 -0500
committerMonty Taylor <mordred@inaugust.com>2013-01-24 16:26:43 +1100
commit827547a0b3da411441bf691ddbc94867001a3311 (patch)
tree17fb6b54fa0e00f8fa41d447f865e1ceb25b004a /tests/utils.py
parent1bc3ecf25d1b86dcb178d5f59b178bde94f5f667 (diff)
downloadoslo-827547a0b3da411441bf691ddbc94867001a3311.tar.gz
oslo-827547a0b3da411441bf691ddbc94867001a3311.tar.xz
oslo-827547a0b3da411441bf691ddbc94867001a3311.zip
Use testtools as test base class.
On the path to testr migration, we need to replace the unittest base classes with testtools. Replace tearDown with addCleanup, addCleanup is more resilient than tearDown. The fixtures library has excellent support for managing and cleaning tempfiles. Use it. Replace skip_ with testtools.skipTest Part of blueprint grizzly-testtools. Change-Id: I45e11bbb1ff9b31f3278d3b016737dcb7850cd98
Diffstat (limited to 'tests/utils.py')
-rw-r--r--tests/utils.py14
1 files changed, 5 insertions, 9 deletions
diff --git a/tests/utils.py b/tests/utils.py
index 883e5f6..2cbcd5b 100644
--- a/tests/utils.py
+++ b/tests/utils.py
@@ -19,24 +19,20 @@
import stubout
import subprocess
-import unittest
+import testtools
from openstack.common import cfg
+from openstack.common.fixture import moxstubout
CONF = cfg.CONF
-class BaseTestCase(unittest.TestCase):
+class BaseTestCase(testtools.TestCase):
def setUp(self):
super(BaseTestCase, self).setUp()
- self.stubs = stubout.StubOutForTesting()
-
- def tearDown(self):
- super(BaseTestCase, self).tearDown()
- CONF.reset()
- self.stubs.UnsetAll()
- self.stubs.SmartUnsetAll()
+ self.stubs = self.useFixture(moxstubout.MoxStubout()).stubs
+ self.addCleanup(CONF.reset)
def config(self, **kw):
"""