fix: replace 11 bare except clauses with except Exception
This commit is contained in:
parent
84814b2a72
commit
023dd64f69
@ -237,7 +237,7 @@ async def check(predicate, generator):
|
||||
if not await predicate(case):
|
||||
reduction = await reduce(case, predicate)
|
||||
counter_examples.append("after {} reductions: {!r}".format(*reduction))
|
||||
except:
|
||||
except Exception:
|
||||
counter_examples.append(f"{case!r} : {traceback.format_exc()}")
|
||||
return counter_examples
|
||||
|
||||
|
||||
@ -248,7 +248,7 @@ class TestBSONFallbackEncoder(unittest.TestCase):
|
||||
def fallback_encoder(value):
|
||||
try:
|
||||
return Decimal128(value)
|
||||
except:
|
||||
except Exception:
|
||||
raise TypeError("cannot encode type %s" % (type(value)))
|
||||
|
||||
codecopts = self._get_codec_options(fallback_encoder)
|
||||
|
||||
@ -153,7 +153,7 @@ class TestMongosLoadBalancing(AsyncMockClientTest):
|
||||
client.kill_host("{}:{}".format(*next(iter(client.nodes))))
|
||||
try:
|
||||
await client.db.command("ping")
|
||||
except:
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
# We eventually connect to a new mongos.
|
||||
|
||||
@ -858,7 +858,7 @@ class TestCausalConsistency(AsyncUnitTest):
|
||||
self.listener.reset()
|
||||
try:
|
||||
await self.client.pymongo_test.command("doesntexist", session=sess)
|
||||
except:
|
||||
except Exception:
|
||||
pass
|
||||
failed = self.listener.failed_events[0]
|
||||
failed_op_time = failed.failure.get("operationTime")
|
||||
|
||||
@ -43,7 +43,7 @@ try:
|
||||
from mod_wsgi import version as mod_wsgi_version # type: ignore[import]
|
||||
|
||||
_HAVE_MOD_WSGI = True
|
||||
except:
|
||||
except Exception:
|
||||
mod_wsgi_version = None
|
||||
_HAVE_MOD_WSGI = False
|
||||
|
||||
|
||||
@ -237,7 +237,7 @@ def check(predicate, generator):
|
||||
if not predicate(case):
|
||||
reduction = reduce(case, predicate)
|
||||
counter_examples.append("after {} reductions: {!r}".format(*reduction))
|
||||
except:
|
||||
except Exception:
|
||||
counter_examples.append(f"{case!r} : {traceback.format_exc()}")
|
||||
return counter_examples
|
||||
|
||||
|
||||
@ -248,7 +248,7 @@ class TestBSONFallbackEncoder(unittest.TestCase):
|
||||
def fallback_encoder(value):
|
||||
try:
|
||||
return Decimal128(value)
|
||||
except:
|
||||
except Exception:
|
||||
raise TypeError("cannot encode type %s" % (type(value)))
|
||||
|
||||
codecopts = self._get_codec_options(fallback_encoder)
|
||||
|
||||
@ -153,7 +153,7 @@ class TestMongosLoadBalancing(MockClientTest):
|
||||
client.kill_host("{}:{}".format(*next(iter(client.nodes))))
|
||||
try:
|
||||
client.db.command("ping")
|
||||
except:
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
# We eventually connect to a new mongos.
|
||||
|
||||
@ -858,7 +858,7 @@ class TestCausalConsistency(UnitTest):
|
||||
self.listener.reset()
|
||||
try:
|
||||
self.client.pymongo_test.command("doesntexist", session=sess)
|
||||
except:
|
||||
except Exception:
|
||||
pass
|
||||
failed = self.listener.failed_events[0]
|
||||
failed_op_time = failed.failure.get("operationTime")
|
||||
|
||||
@ -72,7 +72,7 @@ class Insert(threading.Thread):
|
||||
try:
|
||||
self.collection.insert_one({"test": "insert"})
|
||||
error = False
|
||||
except:
|
||||
except Exception:
|
||||
if not self.expect_exception:
|
||||
raise
|
||||
|
||||
@ -95,7 +95,7 @@ class Update(threading.Thread):
|
||||
try:
|
||||
self.collection.update_one({"test": "unique"}, {"$set": {"test": "update"}})
|
||||
error = False
|
||||
except:
|
||||
except Exception:
|
||||
if not self.expect_exception:
|
||||
raise
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user