From: Monty Taylor Date: Thu, 16 May 2013 16:20:51 +0000 (-0700) Subject: Align usage of test skipping. X-Git-Tag: 2014.1~595^2 X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=38ed88a0b698011560ebe74502e0ae4b93c71618;p=openstack-build%2Fheat-build.git Align usage of test skipping. There were three different mechanisms for skipping tests in the suite. For the most part, skipIf was used, so sync to that. Additionally, it was being used as a decorater in most places, but as a call in a few, so make it a decorator everywhere. Finally, if it's on the setUp method, it's not necessary for it to be on any of the individual tests in the class. Change-Id: I7fbd09a6bc015e698a190b989d0f8641c4adb63e --- diff --git a/heat/tests/test_quantum.py b/heat/tests/test_quantum.py index b69f0f74..fb41f069 100644 --- a/heat/tests/test_quantum.py +++ b/heat/tests/test_quantum.py @@ -329,6 +329,7 @@ class QuantumTest(HeatTestCase): class QuantumFloatingIPTest(HeatTestCase): + @skipIf(net.clients.quantumclient is None, "Missing Quantum Client") def setUp(self): super(QuantumFloatingIPTest, self).setUp() self.m.StubOutWithMock(floatingip.FloatingIP, 'quantum') diff --git a/heat/tests/test_s3.py b/heat/tests/test_s3.py index f12597cc..54d892d5 100644 --- a/heat/tests/test_s3.py +++ b/heat/tests/test_s3.py @@ -76,7 +76,6 @@ class s3Test(HeatTestCase): self.assertEqual(s3.S3Bucket.CREATE_COMPLETE, resource.state) return resource - @skipIf(swiftclient is None, 'unable to import swiftclient') def test_create_container_name(self): self.m.ReplayAll() t = template_format.parse(swift_template) @@ -87,7 +86,6 @@ class s3Test(HeatTestCase): self.assertTrue(re.match(self.container_pattern, resource._create_container_name())) - @skipIf(swiftclient is None, 'unable to import swiftclient') def test_attributes(self): swiftclient.Connection.put_container( mox.Regex(self.container_pattern), @@ -125,7 +123,6 @@ class s3Test(HeatTestCase): resource.delete() self.m.VerifyAll() - @skipIf(swiftclient is None, 'unable to import swiftclient') def test_public_read(self): swiftclient.Connection.put_container( mox.Regex(self.container_pattern), @@ -143,7 +140,6 @@ class s3Test(HeatTestCase): resource.delete() self.m.VerifyAll() - @skipIf(swiftclient is None, 'unable to import swiftclient') def test_public_read_write(self): swiftclient.Connection.put_container( mox.Regex(self.container_pattern), @@ -161,7 +157,6 @@ class s3Test(HeatTestCase): resource.delete() self.m.VerifyAll() - @skipIf(swiftclient is None, 'unable to import swiftclient') def test_authenticated_read(self): swiftclient.Connection.put_container( mox.Regex(self.container_pattern), @@ -179,7 +174,6 @@ class s3Test(HeatTestCase): resource.delete() self.m.VerifyAll() - @skipIf(swiftclient is None, 'unable to import swiftclient') def test_website(self): swiftclient.Connection.put_container( @@ -198,7 +192,6 @@ class s3Test(HeatTestCase): resource.delete() self.m.VerifyAll() - @skipIf(swiftclient is None, 'unable to import swiftclient') def test_delete_exception(self): swiftclient.Connection.put_container( @@ -217,7 +210,6 @@ class s3Test(HeatTestCase): self.m.VerifyAll() - @skipIf(swiftclient is None, 'unable to import swiftclient') def test_delete_retain(self): # first run, with retain policy diff --git a/heat/tests/test_swift.py b/heat/tests/test_swift.py index 48ad8954..a036d121 100644 --- a/heat/tests/test_swift.py +++ b/heat/tests/test_swift.py @@ -77,7 +77,6 @@ class swiftTest(HeatTestCase): self.assertEqual(swift.SwiftContainer.CREATE_COMPLETE, resource.state) return resource - @skipIf(swiftclient is None, 'unable to import swiftclient') def test_create_container_name(self): self.m.ReplayAll() t = template_format.parse(swift_template) @@ -93,7 +92,6 @@ class swiftTest(HeatTestCase): 'the_name', resource._create_container_name('the_name')) - @skipIf(swiftclient is None, 'unable to import swiftclient') def test_build_meta_headers(self): self.m.UnsetStubs() self.assertEqual({}, swift.SwiftContainer._build_meta_headers({})) @@ -107,7 +105,6 @@ class swiftTest(HeatTestCase): "Web-Error": "error.html" })) - @skipIf(swiftclient is None, 'unable to import swiftclient') def test_attributes(self): headers = { "content-length": "0", @@ -162,7 +159,6 @@ class swiftTest(HeatTestCase): resource.delete() self.m.VerifyAll() - @skipIf(swiftclient is None, 'unable to import swiftclient') def test_public_read(self): swiftclient.Connection.put_container( mox.Regex(self.container_pattern), @@ -180,7 +176,6 @@ class swiftTest(HeatTestCase): resource.delete() self.m.VerifyAll() - @skipIf(swiftclient is None, 'unable to import swiftclient') def test_public_read_write(self): swiftclient.Connection.put_container( mox.Regex(self.container_pattern), @@ -199,7 +194,6 @@ class swiftTest(HeatTestCase): resource.delete() self.m.VerifyAll() - @skipIf(swiftclient is None, 'unable to import swiftclient') def test_website(self): swiftclient.Connection.put_container( @@ -218,7 +212,6 @@ class swiftTest(HeatTestCase): resource.delete() self.m.VerifyAll() - @skipIf(swiftclient is None, 'unable to import swiftclient') def test_delete_exception(self): swiftclient.Connection.put_container( @@ -237,7 +230,6 @@ class swiftTest(HeatTestCase): self.m.VerifyAll() - @skipIf(swiftclient is None, 'unable to import swiftclient') def test_delete_retain(self): # first run, with retain policy diff --git a/heat/tests/test_template_format.py b/heat/tests/test_template_format.py index eddbb1be..f9676bfb 100644 --- a/heat/tests/test_template_format.py +++ b/heat/tests/test_template_format.py @@ -133,8 +133,8 @@ class JsonYamlResolvedCompareTest(HeatTestCase): for key in stack1.resources: self.assertEqual(stack1.resources[key].t, stack2.resources[key].t) + @skipIf(clients.quantumclient is None, 'quantumclient unavailable') def test_quantum_resolved(self): - skipIf(clients.quantumclient is None, 'quantumclient unavailable') self.compare_stacks('Quantum.template', 'Quantum.yaml', {}) def test_wordpress_resolved(self): diff --git a/heat/tests/test_vpc.py b/heat/tests/test_vpc.py index 65812a54..5748a69e 100644 --- a/heat/tests/test_vpc.py +++ b/heat/tests/test_vpc.py @@ -30,9 +30,9 @@ except ImportError: class VPCTestBase(HeatTestCase): + @skipIf(quantumclient is None, 'quantumclient unavaialble') def setUp(self): super(VPCTestBase, self).setUp() - skipIf(quantumclient is None, 'quantumclient unavaialble') setup_dummy_db() self.m.StubOutWithMock(quantumclient.Client, 'add_interface_router') self.m.StubOutWithMock(quantumclient.Client, 'add_gateway_router')