Use testtools instead of unittest or unittest2.

As part of the move towards testr and parallel test running, we
start to use testtools and fixtures to make the test suite
resilient and more pedantic.

Part of blueprint grizzly-testtools

Change-Id: I90250de9fe21237db34f6a50b89b15863e270aa5
This commit is contained in:
Monty Taylor
2013-02-06 17:01:30 +11:00
committed by Akihiro MOTOKI
parent 2ba9554bf4
commit 511ac76cf2
89 changed files with 535 additions and 698 deletions

View File

@@ -17,10 +17,10 @@
import os
import socket
import unittest2 as unittest
import mock
from oslo.config import cfg
import testtools
from quantum.agent.common import config
from quantum.agent.linux import dhcp
@@ -134,7 +134,7 @@ class FakeV4NoGatewayNetwork:
ports = [FakePort1()]
class TestDhcpBase(unittest.TestCase):
class TestDhcpBase(testtools.TestCase):
def test_base_abc_error(self):
self.assertRaises(TypeError, dhcp.DhcpBase, None)
@@ -195,8 +195,9 @@ class LocalChild(dhcp.DhcpLocalProcess):
self.called.append('spawn')
class TestBase(unittest.TestCase):
class TestBase(testtools.TestCase):
def setUp(self):
super(TestBase, self).setUp()
root = os.path.dirname(os.path.dirname(__file__))
args = ['--config-file',
os.path.join(root, 'etc', 'quantum.conf.test')]
@@ -213,13 +214,11 @@ class TestBase(unittest.TestCase):
self.replace_p = mock.patch('quantum.agent.linux.dhcp.replace_file')
self.execute_p = mock.patch('quantum.agent.linux.utils.execute')
self.addCleanup(self.execute_p.stop)
self.safe = self.replace_p.start()
self.addCleanup(self.replace_p.stop)
self.execute = self.execute_p.start()
def tearDown(self):
self.execute_p.stop()
self.replace_p.stop()
class TestDhcpLocalProcess(TestBase):
def test_active(self):