From: Wu Wenxiang Date: Wed, 19 Feb 2014 13:39:41 +0000 (+0800) Subject: Use len instead of for-loop to get the end index X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=38e192afecd0d08921d4fb4d7166fa156addb6a4;p=openstack-build%2Fcinder-build.git Use len instead of for-loop to get the end index Use len() instead of for-loop to get the end index in file cinder/tests/test_backup_tsm.py Change-Id: I3a7b0e418f8af4881e21eb5273a03dbcd317c27d Closes-Bug: #1282084 --- diff --git a/cinder/tests/test_backup_tsm.py b/cinder/tests/test_backup_tsm.py index 37d528fcf..2548cbd5e 100644 --- a/cinder/tests/test_backup_tsm.py +++ b/cinder/tests/test_backup_tsm.py @@ -109,8 +109,7 @@ class TSMBackupSimulator: ret_msg += ('Total number of objects deleted: 1\n' 'Total number of objects failed: 0') retcode = 0 - for idx, backup in enumerate(self._backup_list[path]): - index = idx + index = len(self._backup_list[path]) - 1 del self._backup_list[path][index] if not len(self._backup_list[path]): del self._backup_list[path]