From b9e5bcb68993c8b51f3955ee691e1f551687da1e Mon Sep 17 00:00:00 2001 From: Zane Bitter Date: Thu, 13 Dec 2012 15:57:59 +0100 Subject: [PATCH] Get rid of nose.main() in unit test files This doesn't actually work and is not universally present, so get rid of it. Tests are run through "nosetests", which does actually work. Change-Id: Ib2d1e857e0aef4eab5fd75ffb1a498d8e9186c01 Signed-off-by: Zane Bitter --- heat/tests/functional/test_AutoScalingMultiAZSample.py | 1 - heat/tests/functional/test_CFN_API_UpdateStack.py | 1 - heat/tests/functional/test_HAProxy_Single_Instance.py | 1 - heat/tests/functional/test_OpenShift_Prebuilt_JEOS.py | 1 - .../test_WordPress_2_Instances_With_EBS_EIP.py | 1 - .../functional/test_WordPress_Composed_Instances.py | 1 - heat/tests/functional/test_WordPress_Single_Instance.py | 1 - .../functional/test_WordPress_Single_Instance_Boto.py | 1 - .../functional/test_WordPress_Single_Instance_With_HA.py | 1 - .../test_WordPress_Single_Instance_With_IHA.py | 1 - heat/tests/functional/test_WordPress_With_LB.py | 1 - heat/tests/functional/test_WordPress_With_RDS.py | 1 - heat/tests/functional/util.py | 7 ------- heat/tests/test_api_aws.py | 7 ------- heat/tests/test_api_cfn_v1.py | 7 ------- heat/tests/test_api_cloudwatch.py | 7 ------- heat/tests/test_api_openstack_v1.py | 7 ------- heat/tests/test_autoscaling.py | 7 ------- heat/tests/test_dbinstance.py | 7 ------- heat/tests/test_dependencies.py | 7 ------- heat/tests/test_eip.py | 7 ------- heat/tests/test_engine_api_utils.py | 1 - heat/tests/test_engine_service.py | 8 -------- heat/tests/test_identifier.py | 7 ------- heat/tests/test_instance.py | 7 ------- heat/tests/test_loadbalancer.py | 7 ------- heat/tests/test_parameters.py | 7 ------- heat/tests/test_parser.py | 7 ------- heat/tests/test_plugin_loader.py | 1 - heat/tests/test_properties.py | 6 ------ heat/tests/test_quantum.py | 7 ------- heat/tests/test_resource.py | 6 ------ heat/tests/test_s3.py | 7 ------- heat/tests/test_template_format.py | 1 - heat/tests/test_urlfetch.py | 1 - heat/tests/test_user.py | 7 ------- heat/tests/test_validate.py | 9 ++------- heat/tests/test_volume.py | 7 ------- heat/tests/test_vpc.py | 8 -------- heat/tests/test_waitcondition.py | 7 ------- heat/tests/test_watch.py | 1 - 41 files changed, 2 insertions(+), 185 deletions(-) diff --git a/heat/tests/functional/test_AutoScalingMultiAZSample.py b/heat/tests/functional/test_AutoScalingMultiAZSample.py index 397967f9e5..151a1cf57d 100644 --- a/heat/tests/functional/test_AutoScalingMultiAZSample.py +++ b/heat/tests/functional/test_AutoScalingMultiAZSample.py @@ -14,7 +14,6 @@ import util import verify -import nose from nose.plugins.attrib import attr import unittest import os diff --git a/heat/tests/functional/test_CFN_API_UpdateStack.py b/heat/tests/functional/test_CFN_API_UpdateStack.py index feae070457..d540de4f5e 100644 --- a/heat/tests/functional/test_CFN_API_UpdateStack.py +++ b/heat/tests/functional/test_CFN_API_UpdateStack.py @@ -16,7 +16,6 @@ import os import util import verify import re -import nose from nose.plugins.attrib import attr import unittest import json diff --git a/heat/tests/functional/test_HAProxy_Single_Instance.py b/heat/tests/functional/test_HAProxy_Single_Instance.py index 6dd2ab3523..0d8fe3d930 100644 --- a/heat/tests/functional/test_HAProxy_Single_Instance.py +++ b/heat/tests/functional/test_HAProxy_Single_Instance.py @@ -14,7 +14,6 @@ import util import verify -import nose from nose.plugins.attrib import attr import unittest import os diff --git a/heat/tests/functional/test_OpenShift_Prebuilt_JEOS.py b/heat/tests/functional/test_OpenShift_Prebuilt_JEOS.py index 58d8af6aad..e97aad3186 100644 --- a/heat/tests/functional/test_OpenShift_Prebuilt_JEOS.py +++ b/heat/tests/functional/test_OpenShift_Prebuilt_JEOS.py @@ -14,7 +14,6 @@ import util import verify -import nose from nose.plugins.attrib import attr import unittest import os diff --git a/heat/tests/functional/test_WordPress_2_Instances_With_EBS_EIP.py b/heat/tests/functional/test_WordPress_2_Instances_With_EBS_EIP.py index 29ed0fba09..45a6f04a11 100644 --- a/heat/tests/functional/test_WordPress_2_Instances_With_EBS_EIP.py +++ b/heat/tests/functional/test_WordPress_2_Instances_With_EBS_EIP.py @@ -14,7 +14,6 @@ import util import verify -import nose from nose.plugins.attrib import attr import unittest import os diff --git a/heat/tests/functional/test_WordPress_Composed_Instances.py b/heat/tests/functional/test_WordPress_Composed_Instances.py index 606649bd89..3b788ac215 100644 --- a/heat/tests/functional/test_WordPress_Composed_Instances.py +++ b/heat/tests/functional/test_WordPress_Composed_Instances.py @@ -14,7 +14,6 @@ import util import verify -import nose from nose.plugins.attrib import attr import unittest import os diff --git a/heat/tests/functional/test_WordPress_Single_Instance.py b/heat/tests/functional/test_WordPress_Single_Instance.py index 375a57cddd..d8d003f49c 100644 --- a/heat/tests/functional/test_WordPress_Single_Instance.py +++ b/heat/tests/functional/test_WordPress_Single_Instance.py @@ -14,7 +14,6 @@ import util import verify -import nose from nose.plugins.attrib import attr import unittest import os diff --git a/heat/tests/functional/test_WordPress_Single_Instance_Boto.py b/heat/tests/functional/test_WordPress_Single_Instance_Boto.py index f0350c8a9d..cac33c076f 100644 --- a/heat/tests/functional/test_WordPress_Single_Instance_Boto.py +++ b/heat/tests/functional/test_WordPress_Single_Instance_Boto.py @@ -14,7 +14,6 @@ import util import verify -import nose from nose.plugins.attrib import attr import unittest import os diff --git a/heat/tests/functional/test_WordPress_Single_Instance_With_HA.py b/heat/tests/functional/test_WordPress_Single_Instance_With_HA.py index 6693e71716..81087dc4b0 100644 --- a/heat/tests/functional/test_WordPress_Single_Instance_With_HA.py +++ b/heat/tests/functional/test_WordPress_Single_Instance_With_HA.py @@ -13,7 +13,6 @@ # import util -import nose from nose.plugins.attrib import attr import unittest import os diff --git a/heat/tests/functional/test_WordPress_Single_Instance_With_IHA.py b/heat/tests/functional/test_WordPress_Single_Instance_With_IHA.py index 24e74b0959..61c5a796d3 100644 --- a/heat/tests/functional/test_WordPress_Single_Instance_With_IHA.py +++ b/heat/tests/functional/test_WordPress_Single_Instance_With_IHA.py @@ -15,7 +15,6 @@ import os import util import verify -import nose from nose.plugins.attrib import attr import unittest import time diff --git a/heat/tests/functional/test_WordPress_With_LB.py b/heat/tests/functional/test_WordPress_With_LB.py index b8f5ec0c3e..dd41969baa 100644 --- a/heat/tests/functional/test_WordPress_With_LB.py +++ b/heat/tests/functional/test_WordPress_With_LB.py @@ -14,7 +14,6 @@ import util import verify -import nose from nose.plugins.attrib import attr import unittest import os diff --git a/heat/tests/functional/test_WordPress_With_RDS.py b/heat/tests/functional/test_WordPress_With_RDS.py index d5a2e049ad..a7d90295d7 100644 --- a/heat/tests/functional/test_WordPress_With_RDS.py +++ b/heat/tests/functional/test_WordPress_With_RDS.py @@ -15,7 +15,6 @@ import os import util import verify -import nose from nose.plugins.attrib import attr import unittest diff --git a/heat/tests/functional/util.py b/heat/tests/functional/util.py index 76eb07f5d4..27d4fd62a8 100644 --- a/heat/tests/functional/util.py +++ b/heat/tests/functional/util.py @@ -13,7 +13,6 @@ # under the License. -import sys import os import optparse import paramiko @@ -22,7 +21,6 @@ import hashlib import email import json import time # for sleep -import nose import errno import tempfile import stat @@ -625,8 +623,3 @@ def remove_host(ip, hostname): tmp.write(line) os.chmod(tmp.name, perms) os.rename(tmp.name, '/etc/hosts') - - -if __name__ == '__main__': - sys.argv.append(__file__) - nose.main() diff --git a/heat/tests/test_api_aws.py b/heat/tests/test_api_aws.py index bad94f7c5b..1db4f37f48 100644 --- a/heat/tests/test_api_aws.py +++ b/heat/tests/test_api_aws.py @@ -13,9 +13,7 @@ # under the License. -import sys import socket -import nose import json import unittest from nose.plugins.attrib import attr @@ -191,8 +189,3 @@ class AWSCommon(unittest.TestCase): def tearDown(self): print "teardown complete" - - -if __name__ == '__main__': - sys.argv.append(__file__) - nose.main() diff --git a/heat/tests/test_api_cfn_v1.py b/heat/tests/test_api_cfn_v1.py index d7b3279ed6..f65fe71f57 100644 --- a/heat/tests/test_api_cfn_v1.py +++ b/heat/tests/test_api_cfn_v1.py @@ -13,9 +13,7 @@ # under the License. -import sys import socket -import nose import mox import json import unittest @@ -1119,8 +1117,3 @@ class StackControllerTest(unittest.TestCase): self.m.UnsetStubs() self.m.VerifyAll() print "teardown complete" - - -if __name__ == '__main__': - sys.argv.append(__file__) - nose.main() diff --git a/heat/tests/test_api_cloudwatch.py b/heat/tests/test_api_cloudwatch.py index c4d9750a34..149390cc9f 100644 --- a/heat/tests/test_api_cloudwatch.py +++ b/heat/tests/test_api_cloudwatch.py @@ -13,9 +13,7 @@ # under the License. -import sys import socket -import nose import mox import json import unittest @@ -478,8 +476,3 @@ class WatchControllerTest(unittest.TestCase): self.m.UnsetStubs() self.m.VerifyAll() print "teardown complete" - - -if __name__ == '__main__': - sys.argv.append(__file__) - nose.main() diff --git a/heat/tests/test_api_openstack_v1.py b/heat/tests/test_api_openstack_v1.py index 3f3efd5a0a..c48f8e8b69 100644 --- a/heat/tests/test_api_openstack_v1.py +++ b/heat/tests/test_api_openstack_v1.py @@ -13,8 +13,6 @@ # under the License. -import sys -import nose import mox import json import unittest @@ -1439,8 +1437,3 @@ class EventControllerTest(ControllerTest, unittest.TestCase): stack_id=stack_identity.stack_id, resource_name=res_name, event_id=event_id) self.m.VerifyAll() - - -if __name__ == '__main__': - sys.argv.append(__file__) - nose.main() diff --git a/heat/tests/test_autoscaling.py b/heat/tests/test_autoscaling.py index 752310d3f8..25f37087c4 100644 --- a/heat/tests/test_autoscaling.py +++ b/heat/tests/test_autoscaling.py @@ -13,10 +13,8 @@ # under the License. -import sys import os -import nose import unittest import mox import json @@ -166,8 +164,3 @@ class AutoScalingTest(unittest.TestCase): resource.resource_id) resource.delete() - - # allows testing of the test directly, shown below - if __name__ == '__main__': - sys.argv.append(__file__) - nose.main() diff --git a/heat/tests/test_dbinstance.py b/heat/tests/test_dbinstance.py index c0dcc2d49e..bba5ec39b4 100644 --- a/heat/tests/test_dbinstance.py +++ b/heat/tests/test_dbinstance.py @@ -13,10 +13,8 @@ # under the License. -import sys import os -import nose import unittest import mox import json @@ -115,8 +113,3 @@ class DBInstanceTest(unittest.TestCase): raise Exception('Expected InvalidTemplateAttribute') self.m.VerifyAll() - - # allows testing of the test directly, shown below - if __name__ == '__main__': - sys.argv.append(__file__) - nose.main() diff --git a/heat/tests/test_dependencies.py b/heat/tests/test_dependencies.py index 3bcac0aa2a..36a1912619 100644 --- a/heat/tests/test_dependencies.py +++ b/heat/tests/test_dependencies.py @@ -13,7 +13,6 @@ # under the License. -import nose import unittest from nose.plugins.attrib import attr @@ -193,9 +192,3 @@ class dependenciesTest(unittest.TestCase): for n in ('last', 'mid1', 'mid2', 'mid3'): self.assertTrue(n in order, "'%s' not found in dependency order" % n) - - -# allows testing of the test directly, shown below -if __name__ == '__main__': - sys.argv.append(__file__) - nose.main() diff --git a/heat/tests/test_eip.py b/heat/tests/test_eip.py index 6203f57316..4482e61486 100644 --- a/heat/tests/test_eip.py +++ b/heat/tests/test_eip.py @@ -13,10 +13,8 @@ # under the License. -import sys import os -import nose import unittest import mox import json @@ -136,8 +134,3 @@ class EIPTest(unittest.TestCase): resource.delete() self.m.VerifyAll() - - # allows testing of the test directly, shown below - if __name__ == '__main__': - sys.argv.append(__file__) - nose.main() diff --git a/heat/tests/test_engine_api_utils.py b/heat/tests/test_engine_api_utils.py index 8650a6bc39..8e50d212e0 100644 --- a/heat/tests/test_engine_api_utils.py +++ b/heat/tests/test_engine_api_utils.py @@ -13,7 +13,6 @@ # under the License. -import nose import unittest from nose.plugins.attrib import attr diff --git a/heat/tests/test_engine_service.py b/heat/tests/test_engine_service.py index 135acb4c74..8a84854d54 100644 --- a/heat/tests/test_engine_service.py +++ b/heat/tests/test_engine_service.py @@ -13,10 +13,8 @@ # under the License. -import sys import os -import nose import unittest import mox import json @@ -788,9 +786,3 @@ class stackServiceTest(unittest.TestCase): self.assertRaises(AttributeError, self.man.set_watch_state, self.ctx, watch_name="nonexistent", state=state) - - -# allows testing of the test directly -if __name__ == '__main__': - sys.argv.append(__file__) - nose.main() diff --git a/heat/tests/test_identifier.py b/heat/tests/test_identifier.py index 30469ba332..c1d45dda6e 100644 --- a/heat/tests/test_identifier.py +++ b/heat/tests/test_identifier.py @@ -13,7 +13,6 @@ # under the License. -import nose import unittest from nose.plugins.attrib import attr import mox @@ -427,9 +426,3 @@ class EventIdentifierTest(unittest.TestCase): def test_event_id(self): ei = identifier.EventIdentifier('t', 's', 'i', '/resources/p', 'e') self.assertEqual(ei.event_id, 'e') - - -# allows testing of the test directly, shown below -if __name__ == '__main__': - sys.argv.append(__file__) - nose.main() diff --git a/heat/tests/test_instance.py b/heat/tests/test_instance.py index 34a3db1248..34fa38b687 100644 --- a/heat/tests/test_instance.py +++ b/heat/tests/test_instance.py @@ -13,10 +13,8 @@ # under the License. -import sys import os -import nose import unittest import mox import json @@ -128,8 +126,3 @@ class instancesTest(unittest.TestCase): self.assertTrue(instance.resource_id is None) self.assertEqual(instance.state, instance.DELETE_COMPLETE) self.m.VerifyAll() - - # allows testing of the test directly, shown below - if __name__ == '__main__': - sys.argv.append(__file__) - nose.main() diff --git a/heat/tests/test_loadbalancer.py b/heat/tests/test_loadbalancer.py index 467fc791eb..46941b3c92 100644 --- a/heat/tests/test_loadbalancer.py +++ b/heat/tests/test_loadbalancer.py @@ -14,10 +14,8 @@ import re -import sys import os -import nose import unittest import mox import json @@ -164,8 +162,3 @@ class LoadBalancerTest(unittest.TestCase): msg = '%s: %r not found in %r' % (msg, expected_regexp.pattern, text) raise self.failureException(msg) - - # allows testing of the test directly, shown below - if __name__ == '__main__': - sys.argv.append(__file__) - nose.main() diff --git a/heat/tests/test_parameters.py b/heat/tests/test_parameters.py index 0f4a34891f..aa41f98a35 100644 --- a/heat/tests/test_parameters.py +++ b/heat/tests/test_parameters.py @@ -13,7 +13,6 @@ # under the License. -import nose import unittest from nose.plugins.attrib import attr import mox @@ -323,9 +322,3 @@ class ParametersTest(unittest.TestCase): 'AWS::StackName': True} self.assertEqual(params.map(lambda p: p.has_default()), expected) - - -# allows testing of the test directly, shown below -if __name__ == '__main__': - sys.argv.append(__file__) - nose.main() diff --git a/heat/tests/test_parser.py b/heat/tests/test_parser.py index c4d68f7573..32f0947294 100644 --- a/heat/tests/test_parser.py +++ b/heat/tests/test_parser.py @@ -13,12 +13,10 @@ # under the License. -import nose import unittest from nose.plugins.attrib import attr import mox import json -import sys from heat.common import context from heat.common import exception @@ -354,8 +352,3 @@ class StackTest(unittest.TestCase): stack.state_set(stack.CREATE_IN_PROGRESS, 'testing') self.assertNotEqual(stack.updated_time, None) self.assertNotEqual(stack.updated_time, stored_time) - -# allows testing of the test directly, shown below -if __name__ == '__main__': - sys.argv.append(__file__) - nose.main() diff --git a/heat/tests/test_plugin_loader.py b/heat/tests/test_plugin_loader.py index ca4feced1a..96dd4a305a 100644 --- a/heat/tests/test_plugin_loader.py +++ b/heat/tests/test_plugin_loader.py @@ -13,7 +13,6 @@ # under the License. -import nose import pkgutil import sys import unittest diff --git a/heat/tests/test_properties.py b/heat/tests/test_properties.py index 99bde479ea..8c6970eea1 100644 --- a/heat/tests/test_properties.py +++ b/heat/tests/test_properties.py @@ -339,9 +339,3 @@ class PropertiesValidationTest(unittest.TestCase): schema = {'foo': {'Type': 'String'}} props = properties.Properties(schema, {'foo': 42}) self.assertNotEqual(props.validate(), None) - - -# allows testing of the test directly, shown below -if __name__ == '__main__': - sys.argv.append(__file__) - nose.main() diff --git a/heat/tests/test_quantum.py b/heat/tests/test_quantum.py index 91c81736e5..82506faa02 100644 --- a/heat/tests/test_quantum.py +++ b/heat/tests/test_quantum.py @@ -13,10 +13,8 @@ # under the License. -import sys import os -import nose import unittest import mox import json @@ -166,8 +164,3 @@ class QuantumTest(unittest.TestCase): resource.delete() self.m.VerifyAll() - - # allows testing of the test directly, shown below - if __name__ == '__main__': - sys.argv.append(__file__) - nose.main() diff --git a/heat/tests/test_resource.py b/heat/tests/test_resource.py index 68f6023ae8..2720450f6d 100644 --- a/heat/tests/test_resource.py +++ b/heat/tests/test_resource.py @@ -13,7 +13,6 @@ # under the License. -import nose import unittest from nose.plugins.attrib import attr import mox @@ -147,8 +146,3 @@ class MetadataTest(unittest.TestCase): test_data = {'Test': 'Newly-written data'} self.res.metadata = test_data self.assertEqual(self.res.metadata, test_data) - -# allows testing of the test directly, shown below -if __name__ == '__main__': - sys.argv.append(__file__) - nose.main() diff --git a/heat/tests/test_s3.py b/heat/tests/test_s3.py index 6577c0cdb7..0d5ca30318 100644 --- a/heat/tests/test_s3.py +++ b/heat/tests/test_s3.py @@ -13,11 +13,9 @@ # under the License. -import sys import os import re -import nose import unittest import mox import json @@ -243,8 +241,3 @@ class s3Test(unittest.TestCase): return raise Exception('delete_container was called despite Retain policy') - - # allows testing of the test directly, shown below - if __name__ == '__main__': - sys.argv.append(__file__) - nose.main() diff --git a/heat/tests/test_template_format.py b/heat/tests/test_template_format.py index aa05daee61..ce65735efd 100644 --- a/heat/tests/test_template_format.py +++ b/heat/tests/test_template_format.py @@ -14,7 +14,6 @@ import json import mox -import nose from nose.plugins.attrib import attr import os import re diff --git a/heat/tests/test_urlfetch.py b/heat/tests/test_urlfetch.py index a2d3952940..c0ab8c7cf5 100644 --- a/heat/tests/test_urlfetch.py +++ b/heat/tests/test_urlfetch.py @@ -14,7 +14,6 @@ # under the License. import mox -import nose from nose.plugins.attrib import attr import StringIO import unittest diff --git a/heat/tests/test_user.py b/heat/tests/test_user.py index f76e2d0d6f..c90f9924dc 100644 --- a/heat/tests/test_user.py +++ b/heat/tests/test_user.py @@ -13,12 +13,10 @@ # under the License. -import sys import os import eventlet import json -import nose import mox import unittest @@ -182,8 +180,3 @@ class UserTest(unittest.TestCase): resource.state) self.m.VerifyAll() - -# allows testing of the test directly, shown below -if __name__ == '__main__': - sys.argv.append(__file__) - nose.main() diff --git a/heat/tests/test_validate.py b/heat/tests/test_validate.py index 280d2c09f8..2df58d30c7 100644 --- a/heat/tests/test_validate.py +++ b/heat/tests/test_validate.py @@ -11,8 +11,8 @@ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. -import sys -import nose + + import unittest import mox import json @@ -291,8 +291,3 @@ class validateTest(unittest.TestCase): res = dict(engine. validate_template(None, t)) self.assertNotEqual(res['Description'], 'Successfully validated') - - # allows testing of the test directly, shown below - if __name__ == '__main__': - sys.argv.append(__file__) - nose.main() diff --git a/heat/tests/test_volume.py b/heat/tests/test_volume.py index af38d73879..3fbdbcea3d 100644 --- a/heat/tests/test_volume.py +++ b/heat/tests/test_volume.py @@ -13,12 +13,10 @@ # under the License. -import sys import os import eventlet import json -import nose import mox import unittest @@ -223,11 +221,6 @@ class VolumeTest(unittest.TestCase): self.m.VerifyAll() - # allows testing of the test directly, shown below - if __name__ == '__main__': - sys.argv.append(__file__) - nose.main() - class FakeVolume: status = 'attaching' diff --git a/heat/tests/test_vpc.py b/heat/tests/test_vpc.py index 314c9b36bf..5c0c003d56 100644 --- a/heat/tests/test_vpc.py +++ b/heat/tests/test_vpc.py @@ -13,9 +13,6 @@ # under the License. -import sys - -import nose import unittest import mox @@ -114,8 +111,3 @@ class QuantumTest(unittest.TestCase): self.assertEqual(None, resource.delete()) self.m.VerifyAll() - - # allows testing of the test directly, shown below - if __name__ == '__main__': - sys.argv.append(__file__) - nose.main() diff --git a/heat/tests/test_waitcondition.py b/heat/tests/test_waitcondition.py index 03d0a6c23b..65f53342ec 100644 --- a/heat/tests/test_waitcondition.py +++ b/heat/tests/test_waitcondition.py @@ -15,12 +15,10 @@ import json import mox -import sys import uuid import time import eventlet -import nose import unittest from nose.plugins.attrib import attr from heat.tests import fakes @@ -234,8 +232,3 @@ class WaitConditionHandleTest(unittest.TestCase): stack.delete() self.m.VerifyAll() - -# allows testing of the test directly -if __name__ == '__main__': - sys.argv.append(__file__) - nose.main() diff --git a/heat/tests/test_watch.py b/heat/tests/test_watch.py index c453d5f4e0..8a61a4face 100644 --- a/heat/tests/test_watch.py +++ b/heat/tests/test_watch.py @@ -15,7 +15,6 @@ import datetime import mox -import nose from nose.plugins.attrib import attr from nose import with_setup import unittest