]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Update hacking to hacking>=0.8.0,<0.9
authorAvishay Traeger <avishay@il.ibm.com>
Tue, 3 Dec 2013 07:44:35 +0000 (09:44 +0200)
committerAvishay Traeger <avishay@il.ibm.com>
Tue, 3 Dec 2013 13:24:19 +0000 (15:24 +0200)
Update hacking version to match version specified in requirements repo.

Fixed the following issues, which the newer version checks for:
print "" -> print("")
self.assertEquals -> self.assertEqual
self.assertNotEquals -> self.assertNotEqual

Change-Id: Ic4b70fd8f565cda28e23fe6b1da0e278f949373c
Closes-Bug: #1256738
Closes-Bug: #1256737
Closes-Bug: #1257274

bin/cinder-rtstool
cinder/tests/scheduler/test_chance_weigher.py
cinder/tests/test_backup_ceph.py
cinder/tests/test_context.py
cinder/tests/test_db_api.py
cinder/tests/test_image_utils.py
cinder/tests/test_nexenta.py
cinder/tests/test_storwize_svc.py
cinder/tests/test_utils.py
test-requirements.txt

index 5781b7ed9e1d546a0d02f1fed11a6b73d90e2da9..07fe5947d9ca9e31fefef2bec6be5fd7c91c34f4 100755 (executable)
@@ -37,7 +37,7 @@ def create(backing_device, name, userid, password, initiator_iqns=None):
     try:
         rtsroot = rtslib.root.RTSRoot()
     except rtslib.utils.RTSLibError:
-        print _('Ensure that configfs is mounted at /sys/kernel/config.')
+        print(_('Ensure that configfs is mounted at /sys/kernel/config.'))
         raise
 
     # Look to see if BlockStorageObject already exists
@@ -94,8 +94,8 @@ def create(backing_device, name, userid, password, initiator_iqns=None):
     try:
         rtslib.NetworkPortal(tpg_new, '0.0.0.0', 3260, mode='any')
     except rtslib.utils.RTSLibError:
-        print _('Error creating NetworkPortal: ensure port 3260 '
-                'is not in use by another service.')
+        print(_('Error creating NetworkPortal: ensure port 3260 '
+                'is not in use by another service.'))
         raise
 
     try:
@@ -109,7 +109,7 @@ def add_initiator(target_iqn, initiator_iqn, userid, password):
     try:
         rtsroot = rtslib.root.RTSRoot()
     except rtslib.utils.RTSLibError:
-        print _('Ensure that configfs is mounted at /sys/kernel/config.')
+        print(_('Ensure that configfs is mounted at /sys/kernel/config.'))
         raise
 
     # Look for the target
@@ -165,15 +165,15 @@ def verify_rtslib():
 
 
 def usage():
-    print "Usage:"
-    print sys.argv[0], \
-        "create [device] [name] [userid] [password]", \
-        "<initiator_iqn,iqn2,iqn3,...>"
-    print sys.argv[0], \
-        "add-initiator [target_iqn] [userid] [password] [initiator_iqn]"
-    print sys.argv[0], "get-targets"
-    print sys.argv[0], "delete [iqn]"
-    print sys.argv[0], "verify"
+    print("Usage:")
+    print(sys.argv[0] +
+          " create [device] [name] [userid] [password]" +
+          " <initiator_iqn,iqn2,iqn3,...>")
+    print(sys.argv[0] +
+          " add-initiator [target_iqn] [userid] [password] [initiator_iqn]")
+    print(sys.argv[0] + " get-targets")
+    print(sys.argv[0] + " delete [iqn]")
+    print(sys.argv[0] + " verify")
     sys.exit(1)
 
 
index 4c6b448f17d0d1a7ee21d566fdcf6914c6a1b68c..9beebdb7bdbe0a3b359d75b4334eb477b823b3ad 100644 (file)
@@ -47,19 +47,19 @@ class ChanceWeigherTestCase(test.TestCase):
         self.fake_random(reset=True)
         host_state = {'host': 'host.example.com', 'free_capacity_gb': 99999}
         weight = weigher._weigh_object(host_state, None)
-        self.assertEquals(1.0, weight)
+        self.assertEqual(1.0, weight)
         weight = weigher._weigh_object(host_state, None)
-        self.assertEquals(2.0, weight)
+        self.assertEqual(2.0, weight)
         weight = weigher._weigh_object(host_state, None)
-        self.assertEquals(3.0, weight)
+        self.assertEqual(3.0, weight)
 
     def test_host_manager_choosing_chance_weigher(self):
         # ensure HostManager can load the ChanceWeigher
         # via the entry points mechanism
         hm = host_manager.HostManager()
         weighers = hm._choose_host_weighers('ChanceWeigher')
-        self.assertEquals(1, len(weighers))
-        self.assertEquals(weighers[0], ChanceWeigher)
+        self.assertEqual(1, len(weighers))
+        self.assertEqual(weighers[0], ChanceWeigher)
 
     def test_use_of_chance_weigher_via_host_manager(self):
         # ensure we don't lose any hosts when weighing with
@@ -68,4 +68,4 @@ class ChanceWeigherTestCase(test.TestCase):
         fake_hosts = [host_manager.HostState('fake_host%s' % x)
                       for x in xrange(1, 5)]
         weighed_hosts = hm.get_weighed_hosts(fake_hosts, {}, 'ChanceWeigher')
-        self.assertEquals(4, len(weighed_hosts))
+        self.assertEqual(4, len(weighed_hosts))
index 55dbe6dde6529012560edf5e36e4f810650d7dbb..d0d08323356b5f19b51a592a0ac7d357c6305a0d 100644 (file)
@@ -397,9 +397,9 @@ class BackupCephTestCase(test.TestCase):
 
             self.service.backup(backup, rbd_io)
 
-            self.assertEquals(self.called, ['list', 'popen_init', 'read',
-                                            'popen_init', 'write',
-                                            'stdout_close', 'communicate'])
+            self.assertEqual(self.called, ['list', 'popen_init', 'read',
+                                           'popen_init', 'write',
+                                           'stdout_close', 'communicate'])
 
             # Ensure the files are equal
             self.assertEqual(checksum.digest(), self.checksum.digest())
@@ -515,7 +515,7 @@ class BackupCephTestCase(test.TestCase):
 
         self.stubs.Set(self.service.rbd.RBD, 'remove', remove)
         self.service.delete(backup)
-        self.assertEquals(self.called, ['remove'])
+        self.assertEqual(self.called, ['remove'])
 
     def test_try_delete_base_image(self):
         # don't create volume db entry since it should not be required
@@ -538,7 +538,7 @@ class BackupCephTestCase(test.TestCase):
 
         self.stubs.Set(self.service.rbd.RBD, 'remove', remove)
         self.service.delete(backup)
-        self.assertEquals(self.called, ['remove'])
+        self.assertEqual(self.called, ['remove'])
 
     def test_try_delete_base_image_busy(self):
         """This should induce retries then raise rbd.ImageBusy."""
@@ -658,8 +658,8 @@ class BackupCephTestCase(test.TestCase):
         self.stubs.Set(fcntl, 'fcntl', lambda *args, **kwargs: 0)
         self._setup_mock_popen(self, ['out', 'err'])
         self.service._piped_execute(['foo'], ['bar'])
-        self.assertEquals(self.called, ['popen_init', 'popen_init',
-                                        'stdout_close', 'communicate'])
+        self.assertEqual(self.called, ['popen_init', 'popen_init',
+                                       'stdout_close', 'communicate'])
 
     def tearDown(self):
         self.volume_file.close()
index 48323c7a9b28055adaa91a1c8d07dd8da197fa62..6725594133c882ca612923fc4c6ceab9f8ae1ce5 100644 (file)
@@ -86,4 +86,4 @@ class ContextTestCase(test.TestCase):
         compute_catalog = [{u'type': u'compute', u'name': u'nova'}]
         ctxt = context.RequestContext('111', '222',
                                       service_catalog=service_catalog)
-        self.assertEquals(ctxt.service_catalog, compute_catalog)
+        self.assertEqual(ctxt.service_catalog, compute_catalog)
index 5b96d966b67002c72700de735ea3640c6e9990ea..d653e9e7274cb6cbd46c823e77a37a263866f2f2 100644 (file)
@@ -461,7 +461,7 @@ class DBAPIVolumeTestCase(BaseTest):
         db.volume_create(self.ctxt, {'id': 1, 'metadata': metadata})
         db.volume_metadata_delete(self.ctxt, 1, 'c')
         metadata.pop('c')
-        self.assertEquals(metadata, db.volume_metadata_get(self.ctxt, 1))
+        self.assertEqual(metadata, db.volume_metadata_get(self.ctxt, 1))
 
 
 class DBAPISnapshotTestCase(BaseTest):
index def72d4a4a5bd0131992eff0a639efbf36a007af..4ff5a5214acebb16600792378b4a5eef3842c06c 100644 (file)
@@ -177,21 +177,21 @@ class TestUtils(test.TestCase):
 
         inf = image_utils.qemu_img_info(TEST_PATH)
 
-        self.assertEquals(inf.image, 'qemu.qcow2')
-        self.assertEquals(inf.backing_file, 'qemu.qcow2')
-        self.assertEquals(inf.file_format, 'qcow2')
-        self.assertEquals(inf.virtual_size, 52428800)
-        self.assertEquals(inf.cluster_size, 65536)
-        self.assertEquals(inf.disk_size, 200704)
-
-        self.assertEquals(inf.snapshots[0]['id'], '1')
-        self.assertEquals(inf.snapshots[0]['tag'], 'snap1')
-        self.assertEquals(inf.snapshots[0]['vm_size'], '1.7G')
-        self.assertEquals(inf.snapshots[0]['date'], '2011-10-04')
-        self.assertEquals(inf.snapshots[0]['vm_clock'],
-                          '19:04:00 32:06:34.974')
-
-        self.assertEquals(str(inf), TEST_STR)
+        self.assertEqual(inf.image, 'qemu.qcow2')
+        self.assertEqual(inf.backing_file, 'qemu.qcow2')
+        self.assertEqual(inf.file_format, 'qcow2')
+        self.assertEqual(inf.virtual_size, 52428800)
+        self.assertEqual(inf.cluster_size, 65536)
+        self.assertEqual(inf.disk_size, 200704)
+
+        self.assertEqual(inf.snapshots[0]['id'], '1')
+        self.assertEqual(inf.snapshots[0]['tag'], 'snap1')
+        self.assertEqual(inf.snapshots[0]['vm_size'], '1.7G')
+        self.assertEqual(inf.snapshots[0]['date'], '2011-10-04')
+        self.assertEqual(inf.snapshots[0]['vm_clock'],
+                         '19:04:00 32:06:34.974')
+
+        self.assertEqual(str(inf), TEST_STR)
 
     def _test_fetch_to_raw(self, has_qemu=True, src_inf=None, dest_inf=None):
         mox = self._mox
index efb35336cd814af149df75f01394a77217160add..53917968d3365f98af4ae9be2c621ef71847585a 100644 (file)
@@ -749,7 +749,7 @@ class TestNexentaUtils(test.TestCase):
         )
 
         for value, result in values_to_test:
-            self.assertEquals(utils.str2size(value), result)
+            self.assertEqual(utils.str2size(value), result)
 
         # Invalid format value
         self.assertRaises(ValueError, utils.str2size, 'A')
@@ -775,4 +775,4 @@ class TestNexentaUtils(test.TestCase):
               '/rest/nms/')),
         )
         for url, result in urls:
-            self.assertEquals(utils.parse_nms_url(url), result)
+            self.assertEqual(utils.parse_nms_url(url), result)
index bf48525fecd14bf83f09903a7bcd053ee15065d3..5ed244d86c4f1a1cf7cabe16c3186d8648d2a8b6 100644 (file)
@@ -2263,7 +2263,7 @@ class StorwizeSVCDriverTestCase(test.TestCase):
         volume = self._generate_vol_info(None, None)
         volume['volume_type_id'] = None
         self.driver.create_volume(volume)
-        self.assertNotEquals(cap['extent_size'], self.driver._extent_size)
+        self.assertNotEqual(cap['extent_size'], self.driver._extent_size)
         self.driver.migrate_volume(ctxt, volume, host)
         self.driver.delete_volume(volume)
 
index cde2a96a5243c4ce0f3020b9ff932812b9370c1e..fb0a5287863d6fb66f9ebf177a5b8200a2b46378 100644 (file)
@@ -77,9 +77,9 @@ exit 1
             fp = open(tmpfilename2, 'r+')
             runs = fp.read()
             fp.close()
-            self.assertNotEquals(runs.strip(), 'failure', 'stdin did not '
-                                                          'always get passed '
-                                                          'correctly')
+            self.assertNotEqual(runs.strip(), 'failure', 'stdin did not '
+                                                         'always get passed '
+                                                         'correctly')
             runs = int(runs.strip())
             self.assertEqual(runs, 10, 'Ran %d times instead of 10.' % (runs,))
         finally:
index 35f6c829875e96ee48851977b4faccd19fd92204..e7ecbaacba64a81d381e4db6ab4c7d7f357c4ceb 100644 (file)
@@ -1,5 +1,5 @@
 # Install bounded pep8/pyflakes first, then let flake8 install
-hacking>=0.5.6,<0.8
+hacking>=0.8.0,<0.9
 coverage>=3.6
 discover
 fixtures>=0.3.14