]> review.fuel-infra Code Review - openstack-build/heat-build.git/commitdiff
Align usage of test skipping.
authorMonty Taylor <mordred@inaugust.com>
Thu, 16 May 2013 16:20:51 +0000 (09:20 -0700)
committerMonty Taylor <mordred@inaugust.com>
Fri, 17 May 2013 15:14:10 +0000 (08:14 -0700)
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

heat/tests/test_quantum.py
heat/tests/test_s3.py
heat/tests/test_swift.py
heat/tests/test_template_format.py
heat/tests/test_vpc.py

index b69f0f74fc5ded02b019910e8bb77e946cb87e0d..fb41f0691a2ccff52b1f9c6093ee54610c99fcac 100644 (file)
@@ -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')
index f12597ccc4e84c3cf9535ffb4eafd98b759c08b2..54d892d546071b230ba71331899440465682fc54 100644 (file)
@@ -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
index 48ad89545fa214bd7e2f1d2880dc61581790d7f6..a036d121e940ff52fe4c619cffc7f574a4645684 100644 (file)
@@ -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
index eddbb1be02ee5adde9d370d1704f7e0da71bee3b..f9676bfb2c7d3d24ea93460b8673228582d79d0b 100644 (file)
@@ -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):
index 65812a54921f85e3c921d3e2149d20644792ff0f..5748a69e2f9c3db495005d37e24387e473b56d00 100644 (file)
@@ -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')