Remove empty setUp/tearDown methods

Python will call into the parent classes implementation of setUp/tearDown
if there is no implementation in the child

Also, make sure all setUp implementations subclassed off test.TestClass
call the parent setUp so everything gets setup correctly

Change-Id: If410cd412d9557a0d3172ec96b592fbd3fd67ffd
This commit is contained in:
Johannes Erdfelt
2012-03-02 00:08:25 +00:00
parent 8d01f63cf5
commit 42a39e1f37
11 changed files with 1 additions and 41 deletions

View File

@@ -32,9 +32,6 @@ class RpcCarrotTestCase(common._BaseRpcTestCase):
self.rpc = impl_carrot self.rpc = impl_carrot
super(RpcCarrotTestCase, self).setUp(supports_timeouts=False) super(RpcCarrotTestCase, self).setUp(supports_timeouts=False)
def tearDown(self):
super(RpcCarrotTestCase, self).tearDown()
def test_connectionpool_single(self): def test_connectionpool_single(self):
"""Test that ConnectionPool recycles a single connection.""" """Test that ConnectionPool recycles a single connection."""
conn1 = self.rpc.ConnectionPool.get() conn1 = self.rpc.ConnectionPool.get()

View File

@@ -31,6 +31,3 @@ class RpcFakeTestCase(common._BaseRpcTestCase):
def setUp(self): def setUp(self):
self.rpc = impl_fake self.rpc = impl_fake
super(RpcFakeTestCase, self).setUp() super(RpcFakeTestCase, self).setUp()
def tearDown(self):
super(RpcFakeTestCase, self).tearDown()

View File

@@ -32,7 +32,7 @@ SSL_KEYFILE = "/tmp/keyfile.blah.blah"
class RpcKombuSslTestCase(test.TestCase): class RpcKombuSslTestCase(test.TestCase):
def setUp(self): def setUp(self):
test.TestCase.setUp(self) super(RpcKombuSslTestCase, self).setUp()
self.flags(kombu_ssl_keyfile=SSL_KEYFILE, self.flags(kombu_ssl_keyfile=SSL_KEYFILE,
kombu_ssl_ca_certs=SSL_CA_CERT, kombu_ssl_ca_certs=SSL_CA_CERT,
kombu_ssl_certfile=SSL_CERT, kombu_ssl_certfile=SSL_CERT,

View File

@@ -36,9 +36,6 @@ class LeastCostTestCase(test.TestCase):
self.flags(reserved_host_disk_mb=0, reserved_host_memory_mb=0) self.flags(reserved_host_disk_mb=0, reserved_host_memory_mb=0)
self.host_manager = fakes.FakeHostManager() self.host_manager = fakes.FakeHostManager()
def tearDown(self):
super(LeastCostTestCase, self).tearDown()
def _get_all_hosts(self): def _get_all_hosts(self):
ctxt = context.get_admin_context() ctxt = context.get_admin_context()
fakes.mox_host_manager_db_calls(self.mox, ctxt) fakes.mox_host_manager_db_calls(self.mox, ctxt)
@@ -93,13 +90,6 @@ class LeastCostTestCase(test.TestCase):
class TestWeightedHost(test.TestCase): class TestWeightedHost(test.TestCase):
def setUp(self):
pass
def tearDown(self):
pass
def test_dict_conversion_without_host_state(self): def test_dict_conversion_without_host_state(self):
host = least_cost.WeightedHost('someweight') host = least_cost.WeightedHost('someweight')
expected = {'weight': 'someweight'} expected = {'weight': 'someweight'}

View File

@@ -27,9 +27,6 @@ class SolidFireVolumeTestCase(test.TestCase):
def setUp(self): def setUp(self):
super(SolidFireVolumeTestCase, self).setUp() super(SolidFireVolumeTestCase, self).setUp()
def tearDown(self):
pass
def fake_issue_api_request(obj, method, params): def fake_issue_api_request(obj, method, params):
if method is 'GetClusterInfo': if method is 'GetClusterInfo':
LOG.info('Called Fake GetClusterInfo...') LOG.info('Called Fake GetClusterInfo...')

View File

@@ -3297,9 +3297,6 @@ class ComputeAPIAggrTestCase(test.TestCase):
self.stubs.Set(rpc, 'call', fake_rpc_method) self.stubs.Set(rpc, 'call', fake_rpc_method)
self.stubs.Set(rpc, 'cast', fake_rpc_method) self.stubs.Set(rpc, 'cast', fake_rpc_method)
def tearDown(self):
super(ComputeAPIAggrTestCase, self).tearDown()
def test_create_invalid_availability_zone(self): def test_create_invalid_availability_zone(self):
"""Ensure InvalidAggregateAction is raised with wrong avail_zone.""" """Ensure InvalidAggregateAction is raised with wrong avail_zone."""
self.assertRaises(exception.InvalidAggregateAction, self.assertRaises(exception.InvalidAggregateAction,
@@ -3515,9 +3512,6 @@ class ComputeAggrTestCase(BaseTestCase):
'availability_zone': 'test_zone', } 'availability_zone': 'test_zone', }
self.aggr = db.aggregate_create(self.context, values) self.aggr = db.aggregate_create(self.context, values)
def tearDown(self):
super(ComputeAggrTestCase, self).tearDown()
def test_add_aggregate_host(self): def test_add_aggregate_host(self):
def fake_driver_add_to_aggregate(context, aggregate, host): def fake_driver_add_to_aggregate(context, aggregate, host):
fake_driver_add_to_aggregate.called = True fake_driver_add_to_aggregate.called = True

View File

@@ -43,9 +43,6 @@ class ConsoleauthTestCase(test.TestCase):
self.manager = utils.import_object(FLAGS.consoleauth_manager) self.manager = utils.import_object(FLAGS.consoleauth_manager)
self.context = context.get_admin_context() self.context = context.get_admin_context()
def tearDown(self):
super(ConsoleauthTestCase, self).tearDown()
def test_tokens_expire(self): def test_tokens_expire(self):
"""Test that tokens expire correctly.""" """Test that tokens expire correctly."""
token = 'mytok' token = 'mytok'

View File

@@ -320,9 +320,6 @@ class AggregateDBApiTestCase(test.TestCase):
self.project_id = 'fake' self.project_id = 'fake'
self.context = context.RequestContext(self.user_id, self.project_id) self.context = context.RequestContext(self.user_id, self.project_id)
def tearDown(self):
super(AggregateDBApiTestCase, self).tearDown()
def test_aggregate_create(self): def test_aggregate_create(self):
"""Ensure aggregate can be created with no metadata.""" """Ensure aggregate can be created with no metadata."""
result = _create_aggregate(metadata=None) result = _create_aggregate(metadata=None)

View File

@@ -34,9 +34,6 @@ class RootwrapTestCase(test.TestCase):
filters.CommandFilter("/bin/cat", "root") # Keep this one last filters.CommandFilter("/bin/cat", "root") # Keep this one last
] ]
def tearDown(self):
super(RootwrapTestCase, self).tearDown()
def test_RegExpFilter_match(self): def test_RegExpFilter_match(self):
usercmd = ["ls", "/root"] usercmd = ["ls", "/root"]
filtermatch = wrapper.match_filter(self.filters, usercmd) filtermatch = wrapper.match_filter(self.filters, usercmd)

View File

@@ -33,9 +33,6 @@ class SignerTestCase(test.TestCase):
super(SignerTestCase, self).setUp() super(SignerTestCase, self).setUp()
self.signer = signer.Signer('uV3F3YluFJax1cknvbcGwgjvx4QpvB+leU8dUj2o') self.signer = signer.Signer('uV3F3YluFJax1cknvbcGwgjvx4QpvB+leU8dUj2o')
def tearDown(self):
super(SignerTestCase, self).tearDown()
# S3 Authorization Signing input & output examples taken from here: # S3 Authorization Signing input & output examples taken from here:
# http://docs.amazonwebservices.com/AmazonS3/latest/dev/ # http://docs.amazonwebservices.com/AmazonS3/latest/dev/
def test_s3_authorization_get(self): def test_s3_authorization_get(self):

View File

@@ -816,9 +816,6 @@ class XenAPIDiffieHellmanTestCase(test.TestCase):
def test_encrypt_really_long_message(self): def test_encrypt_really_long_message(self):
self._test_encryption(''.join(['abcd' for i in xrange(1024)])) self._test_encryption(''.join(['abcd' for i in xrange(1024)]))
def tearDown(self):
super(XenAPIDiffieHellmanTestCase, self).tearDown()
class XenAPIMigrateInstance(test.TestCase): class XenAPIMigrateInstance(test.TestCase):
"""Unit test for verifying migration-related actions.""" """Unit test for verifying migration-related actions."""