From c8a7a5d56de30cb596d21553f5dbf7ea3db866d8 Mon Sep 17 00:00:00 2001 From: Doug Hellmann Date: Mon, 26 Jun 2017 10:57:38 -0400 Subject: [PATCH] allow unhandled exceptions to cause test errors Hiding the unhandled exception in the test with a failure makes it harder to debug the problem. Let them pass unhandled so the test reports an ERROR instead of FAILURE. Change-Id: I4e435a6d276fdf161dac28f08c2c7efedd1d6385 Signed-off-by: Doug Hellmann --- glanceclient/tests/unit/test_ssl.py | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/glanceclient/tests/unit/test_ssl.py b/glanceclient/tests/unit/test_ssl.py index 9bca2ec7..323ac9de 100644 --- a/glanceclient/tests/unit/test_ssl.py +++ b/glanceclient/tests/unit/test_ssl.py @@ -93,8 +93,6 @@ class TestHTTPSVerifyCert(testtools.TestCase): except exc.CommunicationError as e: if 'certificate verify failed' not in e.message: self.fail('No certificate failure message is received') - except Exception: - self.fail('Unexpected exception has been raised') @mock.patch('sys.stderr') def test_v1_requests_cert_verification_no_compression(self, __): @@ -112,8 +110,6 @@ class TestHTTPSVerifyCert(testtools.TestCase): except exc.CommunicationError as e: if 'certificate verify failed' not in e.message: self.fail('No certificate failure message is received') - except Exception as e: - self.fail('Unexpected exception has been raised') @mock.patch('sys.stderr') def test_v2_requests_cert_verification(self, __): @@ -130,8 +126,6 @@ class TestHTTPSVerifyCert(testtools.TestCase): except exc.CommunicationError as e: if 'certificate verify failed' not in e.message: self.fail('No certificate failure message is received') - except Exception: - self.fail('Unexpected exception has been raised') @mock.patch('sys.stderr') def test_v2_requests_cert_verification_no_compression(self, __): @@ -149,8 +143,6 @@ class TestHTTPSVerifyCert(testtools.TestCase): except exc.CommunicationError as e: if 'certificate verify failed' not in e.message: self.fail('No certificate failure message is received') - except Exception as e: - self.fail('Unexpected exception has been raised') @mock.patch('sys.stderr') def test_v2_requests_valid_cert_verification(self, __): @@ -168,8 +160,6 @@ class TestHTTPSVerifyCert(testtools.TestCase): except exc.CommunicationError as e: if 'certificate verify failed' in e.message: self.fail('Certificate failure message is received') - except Exception as e: - self.fail('Unexpected exception has been raised') @mock.patch('sys.stderr') def test_v2_requests_valid_cert_verification_no_compression(self, __): @@ -187,8 +177,6 @@ class TestHTTPSVerifyCert(testtools.TestCase): except exc.CommunicationError as e: if 'certificate verify failed' in e.message: self.fail('Certificate failure message is received') - except Exception as e: - self.fail('Unexpected exception has been raised') @mock.patch('sys.stderr') def test_v2_requests_valid_cert_no_key(self, __): @@ -208,8 +196,6 @@ class TestHTTPSVerifyCert(testtools.TestCase): except exc.CommunicationError as e: if ('PEM lib' not in e.message): self.fail('No appropriate failure message is received') - except Exception as e: - self.fail('Unexpected exception has been raised') @mock.patch('sys.stderr') def test_v2_requests_bad_cert(self, __): @@ -235,8 +221,6 @@ class TestHTTPSVerifyCert(testtools.TestCase): 'PEM lib' not in e.message or six.PY3 and 'PEM lib' not in e.message): self.fail('No appropriate failure message is received') - except Exception as e: - self.fail('Unexpected exception has been raised') @mock.patch('sys.stderr') def test_v2_requests_bad_ca(self, __):