CP review

This commit is contained in:
Noah Stapp 2026-04-13 11:56:29 -04:00
parent 260c8298c6
commit 284dfa28bb
6 changed files with 6 additions and 10 deletions

View File

@ -29,7 +29,6 @@ from pymongo import AsyncMongoClient, message, timeout
from pymongo.errors import AutoReconnect, ConnectionFailure, DuplicateKeyError
from pymongo.hello import HelloCompat
from pymongo.lock import _async_create_lock
from pymongo.read_preferences import ReadPreference
sys.path[0:0] = [""]

View File

@ -48,6 +48,7 @@ from pymongo.errors import (
AutoReconnect,
ConnectionFailure,
NotPrimaryError,
PyMongoError,
ServerSelectionTimeoutError,
WriteConcernError,
)
@ -775,9 +776,7 @@ class TestErrorPropagationAfterEncounteringMultipleErrors(AsyncIntegrationTest):
# Attempt an insertOne operation on any record for any database and collection.
# Expect the insertOne to fail with a server error.
from pymongo.errors import OperationFailure
with self.assertRaises(Exception) as exc:
with self.assertRaises(PyMongoError) as exc:
await client.test.test.insert_one({})
# Assert that the error code of the server error is 91.

View File

@ -705,7 +705,7 @@ class TestTransactionsConvenientAPI(AsyncTransactionsBase):
async with self.client.start_session() as s:
await s.with_transaction(callback)
end = time.monotonic()
self.assertLess(abs(end - start - (no_backoff_time + 2.2)), 1) # sum of 5 backoffs is 2.2
self.assertLess(abs(end - start - (no_backoff_time + 2.2)), 1) # sum of 13 backoffs is 2.2
class TestOptionsInsideTransactionProse(AsyncTransactionsBase):

View File

@ -29,7 +29,6 @@ from pymongo import MongoClient, message, timeout
from pymongo.errors import AutoReconnect, ConnectionFailure, DuplicateKeyError
from pymongo.hello import HelloCompat
from pymongo.lock import _create_lock
from pymongo.read_preferences import ReadPreference
sys.path[0:0] = [""]

View File

@ -48,6 +48,7 @@ from pymongo.errors import (
AutoReconnect,
ConnectionFailure,
NotPrimaryError,
PyMongoError,
ServerSelectionTimeoutError,
WriteConcernError,
)
@ -771,9 +772,7 @@ class TestErrorPropagationAfterEncounteringMultipleErrors(IntegrationTest):
# Attempt an insertOne operation on any record for any database and collection.
# Expect the insertOne to fail with a server error.
from pymongo.errors import OperationFailure
with self.assertRaises(Exception) as exc:
with self.assertRaises(PyMongoError) as exc:
client.test.test.insert_one({})
# Assert that the error code of the server error is 91.

View File

@ -693,7 +693,7 @@ class TestTransactionsConvenientAPI(TransactionsBase):
with self.client.start_session() as s:
s.with_transaction(callback)
end = time.monotonic()
self.assertLess(abs(end - start - (no_backoff_time + 2.2)), 1) # sum of 5 backoffs is 2.2
self.assertLess(abs(end - start - (no_backoff_time + 2.2)), 1) # sum of 13 backoffs is 2.2
class TestOptionsInsideTransactionProse(TransactionsBase):