Start using Pyflakes and Hacking
Instead of globally ignoring pyflakes and hacking warnings, only blacklist those that trigger very frequently so far, in order to clean them up in followup commits. Fix and start gating on the rest already. Change-Id: Ied7c7250061e3bf379e8286e8ce3b9e4af817faf
This commit is contained in:
+1
-1
@@ -24,6 +24,6 @@ FakeResponse = collections.namedtuple('HTTPResponse', ['status'])
|
||||
|
||||
class TestHTTPExceptions(testtools.TestCase):
|
||||
def test_from_response(self):
|
||||
"""exc.from_response should return instance of an HTTP exception"""
|
||||
"""exc.from_response should return instance of an HTTP exception."""
|
||||
out = exc.from_response(FakeResponse(400))
|
||||
self.assertTrue(isinstance(out, exc.HTTPBadRequest))
|
||||
|
||||
+1
-1
@@ -61,7 +61,7 @@ class TestClient(testtools.TestCase):
|
||||
# rather than assertRaises() so that we can check the body of
|
||||
# the exception.
|
||||
self.fail('An exception should have bypassed this line.')
|
||||
except exc.CommunicationError as comm_err:
|
||||
except glanceclient.exc.CommunicationError as comm_err:
|
||||
fail_msg = ("Exception message '%s' should contain '%s'" %
|
||||
(comm_err.message, self.endpoint))
|
||||
self.assertTrue(self.endpoint in comm_err.message, fail_msg)
|
||||
|
||||
@@ -16,9 +16,7 @@
|
||||
# vim: tabstop=4 shiftwidth=4 softtabstop=4
|
||||
|
||||
import argparse
|
||||
import cStringIO
|
||||
import os
|
||||
import sys
|
||||
|
||||
from glanceclient import exc
|
||||
from glanceclient import shell as openstack_shell
|
||||
|
||||
+6
-6
@@ -66,7 +66,7 @@ class TestVerifiedHTTPSConnection(testtools.TestCase):
|
||||
conn = http.VerifiedHTTPSConnection('127.0.0.1', 0,
|
||||
key_file=key_file,
|
||||
cacert=cacert)
|
||||
except:
|
||||
except Exception:
|
||||
self.fail('Failed to init VerifiedHTTPSConnection.')
|
||||
|
||||
def test_ssl_init_bad_key(self):
|
||||
@@ -126,7 +126,7 @@ class TestVerifiedHTTPSConnection(testtools.TestCase):
|
||||
try:
|
||||
conn = http.VerifiedHTTPSConnection('0.0.0.0', 0)
|
||||
conn.verify_callback(None, cert, 0, 0, True)
|
||||
except:
|
||||
except Exception:
|
||||
self.fail('Unexpected exception.')
|
||||
|
||||
def test_ssl_cert_subject_alt_name(self):
|
||||
@@ -141,13 +141,13 @@ class TestVerifiedHTTPSConnection(testtools.TestCase):
|
||||
try:
|
||||
conn = http.VerifiedHTTPSConnection('alt1.example.com', 0)
|
||||
conn.verify_callback(None, cert, 0, 0, True)
|
||||
except:
|
||||
except Exception:
|
||||
self.fail('Unexpected exception.')
|
||||
|
||||
try:
|
||||
conn = http.VerifiedHTTPSConnection('alt2.example.com', 0)
|
||||
conn.verify_callback(None, cert, 0, 0, True)
|
||||
except:
|
||||
except Exception:
|
||||
self.fail('Unexpected exception.')
|
||||
|
||||
def test_ssl_cert_mismatch(self):
|
||||
@@ -161,7 +161,7 @@ class TestVerifiedHTTPSConnection(testtools.TestCase):
|
||||
self.assertEqual(cert.get_subject().commonName, '0.0.0.0')
|
||||
try:
|
||||
conn = http.VerifiedHTTPSConnection('mismatch.example.com', 0)
|
||||
except:
|
||||
except Exception:
|
||||
self.fail('Failed to init VerifiedHTTPSConnection.')
|
||||
|
||||
self.assertRaises(exc.SSLCertificateError,
|
||||
@@ -179,7 +179,7 @@ class TestVerifiedHTTPSConnection(testtools.TestCase):
|
||||
'openstack.example.com')
|
||||
try:
|
||||
conn = http.VerifiedHTTPSConnection('openstack.example.com', 0)
|
||||
except:
|
||||
except Exception:
|
||||
self.fail('Failed to init VerifiedHTTPSConnection.')
|
||||
|
||||
self.assertRaises(exc.SSLCertificateError,
|
||||
|
||||
@@ -300,7 +300,7 @@ class ShellInvalidEndpointTest(utils.TestCase):
|
||||
class ShellStdinHandlingTests(testtools.TestCase):
|
||||
|
||||
def _fake_update_func(self, *args, **kwargs):
|
||||
''' Function to replace glanceclient.images.update,
|
||||
'''Function to replace glanceclient.images.update,
|
||||
to determine the parameters that would be supplied with the update
|
||||
request
|
||||
'''
|
||||
@@ -356,7 +356,7 @@ class ShellStdinHandlingTests(testtools.TestCase):
|
||||
self.gc.images.update = self.real_update_func
|
||||
|
||||
def _do_update(self, image='96d2c7e1-de4e-4612-8aa2-ba26610c804e'):
|
||||
"""call v1/shell's do_image_update function"""
|
||||
"""call v1/shell's do_image_update function."""
|
||||
|
||||
v1shell.do_image_update(
|
||||
self.gc, argparse.Namespace(
|
||||
@@ -410,7 +410,7 @@ class ShellStdinHandlingTests(testtools.TestCase):
|
||||
try:
|
||||
f.close()
|
||||
os.remove(f.name)
|
||||
except:
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
def test_image_update_data_is_read_from_pipe(self):
|
||||
@@ -434,5 +434,5 @@ class ShellStdinHandlingTests(testtools.TestCase):
|
||||
finally:
|
||||
try:
|
||||
process.stdout.close()
|
||||
except:
|
||||
except OSError:
|
||||
pass
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import errno
|
||||
import testtools
|
||||
|
||||
import warlock
|
||||
|
||||
Reference in New Issue
Block a user