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
This commit is contained in:
Monty Taylor
2013-01-22 19:54:57 -05:00
parent 6c0493d95d
commit bce3d83daf

View File

@@ -17,13 +17,13 @@
import datetime
import StringIO
import unittest
import testtools
import xmlrpclib
from openstack.common import jsonutils
class JSONUtilsTestCase(unittest.TestCase):
class JSONUtilsTestCase(testtools.TestCase):
def test_dumps(self):
self.assertEqual(jsonutils.dumps({'a': 'b'}), '{"a": "b"}')
@@ -36,7 +36,7 @@ class JSONUtilsTestCase(unittest.TestCase):
self.assertEqual(jsonutils.load(x), {'a': 'b'})
class ToPrimitiveTestCase(unittest.TestCase):
class ToPrimitiveTestCase(testtools.TestCase):
def test_list(self):
self.assertEquals(jsonutils.to_primitive([1, 2, 3]), [1, 2, 3])