Skip to content

Commit 284dfa2

Browse files
committed
CP review
1 parent 260c829 commit 284dfa2

6 files changed

Lines changed: 6 additions & 10 deletions

File tree

test/asynchronous/test_pooling.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
from pymongo.errors import AutoReconnect, ConnectionFailure, DuplicateKeyError
3030
from pymongo.hello import HelloCompat
3131
from pymongo.lock import _async_create_lock
32-
from pymongo.read_preferences import ReadPreference
3332

3433
sys.path[0:0] = [""]
3534

test/asynchronous/test_retryable_writes.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
AutoReconnect,
4949
ConnectionFailure,
5050
NotPrimaryError,
51+
PyMongoError,
5152
ServerSelectionTimeoutError,
5253
WriteConcernError,
5354
)
@@ -775,9 +776,7 @@ def failed(event: CommandFailedEvent) -> None:
775776

776777
# Attempt an insertOne operation on any record for any database and collection.
777778
# Expect the insertOne to fail with a server error.
778-
from pymongo.errors import OperationFailure
779-
780-
with self.assertRaises(Exception) as exc:
779+
with self.assertRaises(PyMongoError) as exc:
781780
await client.test.test.insert_one({})
782781

783782
# Assert that the error code of the server error is 91.

test/asynchronous/test_transactions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -705,7 +705,7 @@ async def callback(session):
705705
async with self.client.start_session() as s:
706706
await s.with_transaction(callback)
707707
end = time.monotonic()
708-
self.assertLess(abs(end - start - (no_backoff_time + 2.2)), 1) # sum of 5 backoffs is 2.2
708+
self.assertLess(abs(end - start - (no_backoff_time + 2.2)), 1) # sum of 13 backoffs is 2.2
709709

710710

711711
class TestOptionsInsideTransactionProse(AsyncTransactionsBase):

test/test_pooling.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
from pymongo.errors import AutoReconnect, ConnectionFailure, DuplicateKeyError
3030
from pymongo.hello import HelloCompat
3131
from pymongo.lock import _create_lock
32-
from pymongo.read_preferences import ReadPreference
3332

3433
sys.path[0:0] = [""]
3534

test/test_retryable_writes.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
AutoReconnect,
4949
ConnectionFailure,
5050
NotPrimaryError,
51+
PyMongoError,
5152
ServerSelectionTimeoutError,
5253
WriteConcernError,
5354
)
@@ -771,9 +772,7 @@ def failed(event: CommandFailedEvent) -> None:
771772

772773
# Attempt an insertOne operation on any record for any database and collection.
773774
# Expect the insertOne to fail with a server error.
774-
from pymongo.errors import OperationFailure
775-
776-
with self.assertRaises(Exception) as exc:
775+
with self.assertRaises(PyMongoError) as exc:
777776
client.test.test.insert_one({})
778777

779778
# Assert that the error code of the server error is 91.

test/test_transactions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -693,7 +693,7 @@ def callback(session):
693693
with self.client.start_session() as s:
694694
s.with_transaction(callback)
695695
end = time.monotonic()
696-
self.assertLess(abs(end - start - (no_backoff_time + 2.2)), 1) # sum of 5 backoffs is 2.2
696+
self.assertLess(abs(end - start - (no_backoff_time + 2.2)), 1) # sum of 13 backoffs is 2.2
697697

698698

699699
class TestOptionsInsideTransactionProse(TransactionsBase):

0 commit comments

Comments
 (0)