From 8af3b1374c41d83872bd2d94297e5ac8726baaa3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Laur=C3=A9line=20Gu=C3=A9rin?= Date: Fri, 2 Apr 2021 09:10:24 +0200 Subject: [PATCH] misc: pylint fix bare-except (#52630) --- tests/test_publisher.py | 8 ++++---- tests/test_wscall.py | 12 ++++++------ 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/tests/test_publisher.py b/tests/test_publisher.py index 001d52b14..f5defd8a5 100644 --- a/tests/test_publisher.py +++ b/tests/test_publisher.py @@ -52,7 +52,7 @@ def test_plaintext_error(): pub._set_request(req) try: raise Exception('foo') - except: + except Exception: exc_type, exc_value, tb = sys.exc_info() req.form = {'foo': 'bar'} assert pub.USE_LONG_TRACES == True # use long traces by default @@ -74,7 +74,7 @@ def test_finish_failed_request(): pub.USE_LONG_TRACES = False try: raise Exception('foo') - except: + except Exception: exc_type, exc_value, tb = sys.exc_info() req = get_request() @@ -93,7 +93,7 @@ def test_finish_failed_request(): pub._set_request(req) try: raise Exception() - except: + except Exception: body = pub.finish_failed_request() assert 'Traceback (most recent call last)' in str(body) assert '
' not in str(body) @@ -103,7 +103,7 @@ def test_finish_failed_request(): pub._set_request(req) try: raise Exception() - except: + except Exception: body = pub.finish_failed_request() assert 'Traceback (most recent call last)' in str(body) assert '
' in str(body) diff --git a/tests/test_wscall.py b/tests/test_wscall.py index c34cd2708..e9731d3d7 100644 --- a/tests/test_wscall.py +++ b/tests/test_wscall.py @@ -75,14 +75,14 @@ def test_webservice_auto_sign(http_requests, pub): wscall.request = {'url': 'http://blah.example.net'} try: wscall.call() - except: + except Exception: pass assert not 'signature=' in http_requests.get_last('url') wscall.request = {'url': 'http://idp.example.net'} try: wscall.call() - except: + except Exception: pass assert 'orig=example.net' in http_requests.get_last('url') assert 'signature=' in http_requests.get_last('url') @@ -91,7 +91,7 @@ def test_webservice_auto_sign(http_requests, pub): wscall.request = {'url': ' http://idp.example.net'} try: wscall.call() - except: + except Exception: pass assert 'orig=example.net' in http_requests.get_last('url') assert 'signature=' in http_requests.get_last('url') @@ -99,7 +99,7 @@ def test_webservice_auto_sign(http_requests, pub): wscall.request['request_signature_key'] = 'blah' try: wscall.call() - except: + except Exception: pass assert not 'orig=example.net' in http_requests.get_last('url') assert 'signature=' in http_requests.get_last('url') @@ -152,7 +152,7 @@ def test_webservice_post_put_patch(http_requests, pub): } try: wscall.call() - except: + except Exception: pass assert http_requests.get_last('url') == wscall.request['url'] assert http_requests.get_last('method') == wscall.request['method'] @@ -171,7 +171,7 @@ def test_webservice_delete(http_requests, pub): } try: wscall.call() - except: + except Exception: pass assert http_requests.get_last('url') == wscall.request['url'] assert http_requests.get_last('method') == 'DELETE'