Finish up flake8 conversion.

Change-Id: I5034f19d5f9b20ad2b4569455273c730b1efec08
diff --git a/tempest/tests/boto/test_s3_objects.py b/tempest/tests/boto/test_s3_objects.py
index dcb7c86..9d4d79c 100644
--- a/tempest/tests/boto/test_s3_objects.py
+++ b/tempest/tests/boto/test_s3_objects.py
@@ -15,9 +15,9 @@
 #    License for the specific language governing permissions and limitations
 #    under the License.
 
-from contextlib import closing
+import contextlib
 
-from boto.s3.key import Key
+import boto.s3.key
 
 from tempest import clients
 from tempest.common.utils.data_utils import rand_name
@@ -46,7 +46,7 @@
                                 bucket_name)
 
         self.assertTrue(bucket.name == bucket_name)
-        with closing(Key(bucket)) as key:
+        with contextlib.closing(boto.s3.key.Key(bucket)) as key:
             key.key = object_name
             key.set_contents_from_string(content)
             readback = key.get_contents_as_string()
diff --git a/tempest/tests/boto/utils/s3.py b/tempest/tests/boto/utils/s3.py
index 4c3229b..ea9869b 100644
--- a/tempest/tests/boto/utils/s3.py
+++ b/tempest/tests/boto/utils/s3.py
@@ -15,24 +15,24 @@
 #    License for the specific language governing permissions and limitations
 #    under the License.
 
-from contextlib import closing
+import contextlib
 import logging
 import os
 import re
 
 import boto
-from boto.s3.key import Key
+import boto.s3.key
 
 LOG = logging.getLogger(__name__)
 
 
 def s3_upload_dir(bucket, path, prefix="", connection_data=None):
     if isinstance(bucket, basestring):
-        with closing(boto.connect_s3(**connection_data)) as conn:
+        with contextlib.closing(boto.connect_s3(**connection_data)) as conn:
             bucket = conn.lookup(bucket)
     for root, dirs, files in os.walk(path):
         for fil in files:
-            with closing(Key(bucket)) as key:
+            with contextlib.closing(boto.s3.key.Key(bucket)) as key:
                 source = root + os.sep + fil
                 target = re.sub("^" + re.escape(path) + "?/", prefix, source)
                 if os.sep != '/':
diff --git a/tempest/tests/boto/utils/wait.py b/tempest/tests/boto/utils/wait.py
index c2d4ea3..6cd17a9 100644
--- a/tempest/tests/boto/utils/wait.py
+++ b/tempest/tests/boto/utils/wait.py
@@ -19,7 +19,7 @@
 import re
 import time
 
-from boto.exception import BotoServerError
+import boto.exception
 from testtools import TestCase
 
 import tempest.config
@@ -87,7 +87,7 @@
     """Stops waiting on success."""
     start_time = time.time()
     if exc_matcher is not None:
-        exc_class = BotoServerError
+        exc_class = boto.exception.BotoServerError
 
     if exc_class is None:
         exc_class = BaseException
diff --git a/tempest/tests/compute/test_authorization.py b/tempest/tests/compute/test_authorization.py
index 91cf39f..6edc946 100644
--- a/tempest/tests/compute/test_authorization.py
+++ b/tempest/tests/compute/test_authorization.py
@@ -234,8 +234,7 @@
             # Reset the base_url...
             self.alt_security_client.base_url = self.saved_base_url
             if resp['status'] is not None:
-                #TODO(afazekas): body not defined
-                self.alt_security_client.delete_security_group(body['id'])
+                self.alt_security_client.delete_security_group(resp['id'])
                 self.fail("Create Security Group request should not happen if"
                           "the tenant id does not match the current user")
 
@@ -274,8 +273,7 @@
             # Reset the base_url...
             self.alt_security_client.base_url = self.saved_base_url
             if resp['status'] is not None:
-                self.alt_security_client.delete_security_group_rule(
-                    body['id'])  # BUG
+                self.alt_security_client.delete_security_group_rule(resp['id'])
                 self.fail("Create security group rule request should not "
                           "happen if the tenant id does not match the"
                           " current user")
diff --git a/tempest/tests/identity/admin/test_users.py b/tempest/tests/identity/admin/test_users.py
index 0573b21..f9772ac 100644
--- a/tempest/tests/identity/admin/test_users.py
+++ b/tempest/tests/identity/admin/test_users.py
@@ -309,8 +309,8 @@
         for i in body:
             fetched_user_ids.append(i['id'])
         #verifying the user Id in the list
-        missing_users =\
-            [user for user in user_ids if user not in fetched_user_ids]
+        missing_users = [missing_user for missing_user in user_ids
+                         if missing_user not in fetched_user_ids]
         self.assertEqual(0, len(missing_users),
                          "Failed to find user %s in fetched list" %
                          ', '.join(m_user for m_user in missing_users))
diff --git a/tempest/tests/identity/admin/v3/test_endpoints.py b/tempest/tests/identity/admin/v3/test_endpoints.py
index 98fab57..3ad9b28 100755
--- a/tempest/tests/identity/admin/v3/test_endpoints.py
+++ b/tempest/tests/identity/admin/v3/test_endpoints.py
@@ -126,7 +126,6 @@
                                                 description=s_description)
         self.service_ids.append(self.service2['id'])
         #Updating endpoint with new values
-        service_id = self.service2['id']
         region2 = rand_name('region')
         url2 = rand_name('url')
         interface2 = 'internal'
diff --git a/tempest/tests/network/common.py b/tempest/tests/network/common.py
index 8c8d518..6246f54 100644
--- a/tempest/tests/network/common.py
+++ b/tempest/tests/network/common.py
@@ -125,7 +125,6 @@
     @classmethod
     def setUpClass(cls):
         super(TestNetworkSmokeCommon, cls).setUpClass()
-        cfg = cls.config.network
         cls.tenant_id = cls.manager._get_identity_client(
             cls.config.identity.username,
             cls.config.identity.password,
@@ -246,10 +245,7 @@
             port=dict(name=name,
                       network_id=network.id,
                       tenant_id=network.tenant_id))
-        try:
-            result = self.network_client.create_port(body=body)
-        except Exception as e:
-            raise
+        result = self.network_client.create_port(body=body)
         self.assertIsNotNone(result, 'Unable to allocate port')
         port = DeletablePort(client=self.network_client,
                              **result['port'])
diff --git a/tempest/tests/object_storage/test_object_expiry.py b/tempest/tests/object_storage/test_object_expiry.py
index c12ec3d..e1b1dbd 100644
--- a/tempest/tests/object_storage/test_object_expiry.py
+++ b/tempest/tests/object_storage/test_object_expiry.py
@@ -21,7 +21,7 @@
 from tempest.test import attr
 from tempest.tests.object_storage import base
 import testtools
-from time import sleep
+import time
 
 
 class ObjectExpiryTest(base.BaseObjectTest):
@@ -88,7 +88,7 @@
         # Check data
         self.assertEqual(body, data)
         # Sleep for over 5 seconds, so that object is expired
-        sleep(5)
+        time.sleep(5)
         # Verification of raised exception after object gets expired
         self.assertRaises(exceptions.NotFound, self.object_client.get_object,
                           self.container_name, object_name)
diff --git a/tempest/tests/object_storage/test_object_services.py b/tempest/tests/object_storage/test_object_services.py
index 1edce92..4fcc617 100644
--- a/tempest/tests/object_storage/test_object_services.py
+++ b/tempest/tests/object_storage/test_object_services.py
@@ -21,7 +21,7 @@
 from tempest.test import attr
 from tempest.tests.object_storage import base
 import testtools
-from time import time
+import time
 
 
 class ObjectTest(base.BaseObjectTest):
@@ -617,7 +617,7 @@
             self.object_client.create_object(self.container_name,
                                              object_name, data)
 
-            expires = int(time() + 10)
+            expires = int(time.time() + 10)
 
             #Trying to GET object using temp URL with in expiry time
             _, body = self.object_client.get_object_using_temp_url(