misc: pylint fix bare-except (#52630)

This commit is contained in:
Lauréline Guérin 2021-04-02 09:10:24 +02:00
parent 7db86a547d
commit 8af3b1374c
No known key found for this signature in database
GPG Key ID: 1FAB9B9B4F93D473
2 changed files with 10 additions and 10 deletions

View File

@ -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 '<div class="error-page">' 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 '<div class="error-page">' in str(body)

View File

@ -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'