MOTOR-1098 Skip synchro test_typing and encrypted coll tests on standalones (#200)
Snapshot session test needs to wait for the documents to be visible in the latest snapshot.
This commit is contained in:
parent
16c476e618
commit
f9aed97221
@ -48,8 +48,8 @@ excluded_modules = [
|
||||
"test.test_session",
|
||||
# Deprecated in PyMongo, removed in Motor 2.0.
|
||||
"test.test_gridfs",
|
||||
# Skip mypy tests.
|
||||
"test.test_mypy",
|
||||
# Skip mypy/typing tests.
|
||||
"test.test_typing",
|
||||
]
|
||||
|
||||
|
||||
@ -126,6 +126,7 @@ excluded_tests = [
|
||||
"TestCursor.test_comment",
|
||||
"TestCursor.test_where",
|
||||
"TestGridfs.test_gridfs_find",
|
||||
"TestKmsTLSOptions.test_05_tlsDisableOCSPEndpointCheck_is_permitted",
|
||||
# Tests that use "authenticate" or "logoout", removed in Motor 2.0.
|
||||
"TestSASLPlain.test_sasl_plain_bad_credentials",
|
||||
"TestSCRAM.test_scram",
|
||||
|
||||
@ -267,6 +267,7 @@ class TestAsyncIOCollection(AsyncIOTestCase):
|
||||
self.assertEqual(codec_options, c.codec_options)
|
||||
|
||||
@env.require_version_min(6, 2, -1, -1)
|
||||
@env.require_no_standalone
|
||||
@asyncio_test
|
||||
async def test_async_create_encrypted_collection(self):
|
||||
if pymongo.version_tuple < (4, 4, 0):
|
||||
|
||||
@ -1397,8 +1397,9 @@ class TestExamples(AsyncIOTestCase):
|
||||
client = collection.database.client
|
||||
async with await client.start_session(snapshot=True) as s:
|
||||
try:
|
||||
await collection.aggregate([], session=s).to_list(None)
|
||||
return True
|
||||
if await collection.find_one(session=s):
|
||||
return True
|
||||
return False
|
||||
except OperationFailure as e:
|
||||
# Retry them as the server demands...
|
||||
if e.code == 246: # SnapshotUnavailable
|
||||
@ -1417,6 +1418,7 @@ class TestQueryableEncryptionDocsExample(AsyncIOTestCase):
|
||||
# Queryable Encryption is not supported on Standalone topology.
|
||||
|
||||
@env.require_version_min(6, 0)
|
||||
@env.require_version_max(6, 9) # TODO remove in MOTOR-1100
|
||||
@asyncio_test
|
||||
@env.require_replica_set
|
||||
async def test_queryable_encryption(self):
|
||||
|
||||
@ -335,6 +335,10 @@ class TestEnvironment(object):
|
||||
"Server version must be at most %s" % str(other_version),
|
||||
)
|
||||
|
||||
def require_no_standalone(self, func):
|
||||
"""Run a test only if the client is not connected to a standalone."""
|
||||
return self.require(lambda: not self.is_standalone, "Connected to a standalone", func=func)
|
||||
|
||||
def require_replica_set(self, func):
|
||||
"""Run a test only if the client is connected to a replica set."""
|
||||
return self.require(
|
||||
|
||||
@ -268,6 +268,7 @@ class MotorCollectionTest(MotorTest):
|
||||
self.assertEqual(codec_options, c.codec_options)
|
||||
|
||||
@env.require_version_min(6, 2, -1, -1)
|
||||
@env.require_no_standalone
|
||||
@gen_test
|
||||
async def test_async_create_encrypted_collection(self):
|
||||
if pymongo.version_tuple < (4, 4, 0):
|
||||
|
||||
Loading…
Reference in New Issue
Block a user