Add @skip_if_rust_bson to tests for unimplemented Rust features

- TestRawBatchCursor and TestRawBatchCommandCursor (RawBSONDocument not implemented)
- TestBSONCorpus (BSON validation/error detection not fully implemented)
- test_uuid_subtype_4, test_legacy_java_uuid, test_legacy_csharp_uuid (legacy UUID representations not implemented)

These features are not implemented in the Rust extension and would require
significant additional work. Skipping these tests prevents 35 failures.
This commit is contained in:
Jeffrey A. Clark 2026-02-13 22:12:48 -05:00 committed by Jeffrey 'Alex' Clark
parent 96929dbf95
commit 1fdb892068
4 changed files with 22 additions and 4 deletions

View File

@ -30,7 +30,12 @@ import pymongo
sys.path[0:0] = [""]
from test.asynchronous import AsyncIntegrationTest, async_client_context, unittest
from test.asynchronous import (
AsyncIntegrationTest,
async_client_context,
skip_if_rust_bson,
unittest,
)
from test.asynchronous.utils import flaky
from test.utils_shared import (
AllowListEventListener,
@ -1507,6 +1512,7 @@ class TestCursor(AsyncIntegrationTest):
self.assertTrue(ctx.exception.timeout)
@skip_if_rust_bson
class TestRawBatchCursor(AsyncIntegrationTest):
async def test_find_raw(self):
c = self.db.test
@ -1682,6 +1688,7 @@ class TestRawBatchCursor(AsyncIntegrationTest):
await cursor.close()
@skip_if_rust_bson
class TestRawBatchCommandCursor(AsyncIntegrationTest):
async def test_aggregate_raw(self):
c = self.db.test

View File

@ -26,7 +26,7 @@ from typing import Any
sys.path[0:0] = [""]
from test import IntegrationTest, client_context, unittest
from test import IntegrationTest, client_context, skip_if_rust_bson, unittest
import bson
from bson import decode, encode
@ -137,6 +137,7 @@ class TestBinary(unittest.TestCase):
self.assertNotEqual(hash(one), hash(two))
self.assertEqual(hash(Binary(b"hello world", 42)), hash(two))
@skip_if_rust_bson
def test_uuid_subtype_4(self):
"""Only STANDARD should decode subtype 4 as native uuid."""
expected_uuid = uuid.uuid4()
@ -153,6 +154,7 @@ class TestBinary(unittest.TestCase):
opts = CodecOptions(uuid_representation=UuidRepresentation.STANDARD)
self.assertEqual(expected_uuid, decode(encoded, opts)["uuid"])
@skip_if_rust_bson
def test_legacy_java_uuid(self):
# Test decoding
data = BinaryData.java_data
@ -193,6 +195,7 @@ class TestBinary(unittest.TestCase):
)
self.assertEqual(data, encoded)
@skip_if_rust_bson
def test_legacy_csharp_uuid(self):
data = BinaryData.csharp_data

View File

@ -25,7 +25,7 @@ from decimal import DecimalException
sys.path[0:0] = [""]
from test import unittest
from test import skip_if_rust_bson, unittest
from bson import decode, encode, json_util
from bson.binary import STANDARD
@ -96,6 +96,7 @@ decode_extjson = functools.partial(
loads = functools.partial(json.loads, object_pairs_hook=SON)
@skip_if_rust_bson
class TestBSONCorpus(unittest.TestCase):
def assertJsonEqual(self, first, second, msg=None):
"""Fail if the two json strings are unequal.

View File

@ -30,7 +30,12 @@ import pymongo
sys.path[0:0] = [""]
from test import IntegrationTest, client_context, unittest
from test import (
IntegrationTest,
client_context,
skip_if_rust_bson,
unittest,
)
from test.utils import flaky
from test.utils_shared import (
AllowListEventListener,
@ -1498,6 +1503,7 @@ class TestCursor(IntegrationTest):
self.assertTrue(ctx.exception.timeout)
@skip_if_rust_bson
class TestRawBatchCursor(IntegrationTest):
def test_find_raw(self):
c = self.db.test
@ -1671,6 +1677,7 @@ class TestRawBatchCursor(IntegrationTest):
cursor.close()
@skip_if_rust_bson
class TestRawBatchCommandCursor(IntegrationTest):
def test_aggregate_raw(self):
c = self.db.test