Skip to content

Commit c05bbb4

Browse files
committed
Re-apply @skip_if_rust_bson decorators to test classes
These decorators were lost during the earlier force push. Re-applying them to skip tests for unimplemented Rust BSON features: - TestBSONFallbackEncoder - TestBSONCustomTypeEncoderAndFallbackEncoderTandem - TestCollectionWCustomType - TestRawBSONDocument Added to async versions and let synchro generate sync versions.
1 parent 102d90e commit c05bbb4

4 files changed

Lines changed: 12 additions & 4 deletions

File tree

test/asynchronous/test_custom_types.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828

2929
sys.path[0:0] = [""]
3030

31-
from test.asynchronous import AsyncIntegrationTest, async_client_context, unittest
31+
from test.asynchronous import AsyncIntegrationTest, async_client_context, skip_if_rust_bson, unittest
3232

3333
from bson import (
3434
_BUILT_IN_TYPES,
@@ -211,6 +211,7 @@ def setUpClass(cls):
211211
cls.codecopts = codec_options
212212

213213

214+
@skip_if_rust_bson
214215
class TestBSONFallbackEncoder(unittest.TestCase):
215216
def _get_codec_options(self, fallback_encoder):
216217
type_registry = TypeRegistry(fallback_encoder=fallback_encoder)
@@ -336,6 +337,7 @@ def test_type_checks(self):
336337
self.assertFalse(issubclass(TypeEncoder, TypeDecoder))
337338

338339

340+
@skip_if_rust_bson
339341
class TestBSONCustomTypeEncoderAndFallbackEncoderTandem(unittest.TestCase):
340342
TypeA: Any
341343
TypeB: Any
@@ -622,6 +624,7 @@ class MyType(pytype): # type: ignore
622624
run_test(TypeCodec, {"bson_type": Decimal128, "transform_bson": lambda x: x})
623625

624626

627+
@skip_if_rust_bson
625628
class TestCollectionWCustomType(AsyncIntegrationTest):
626629
async def asyncSetUp(self):
627630
await super().asyncSetUp()

test/asynchronous/test_raw_bson.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
sys.path[0:0] = [""]
2121

22-
from test.asynchronous import AsyncIntegrationTest, async_client_context, unittest
22+
from test.asynchronous import AsyncIntegrationTest, async_client_context, skip_if_rust_bson, unittest
2323

2424
from bson import Code, DBRef, decode, encode
2525
from bson.binary import JAVA_LEGACY, Binary, UuidRepresentation
@@ -31,6 +31,7 @@
3131
_IS_SYNC = False
3232

3333

34+
@skip_if_rust_bson
3435
class TestRawBSONDocument(AsyncIntegrationTest):
3536
# {'_id': ObjectId('556df68b6e32ab21a95e0785'),
3637
# 'name': 'Sherlock',

test/test_custom_types.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828

2929
sys.path[0:0] = [""]
3030

31-
from test import IntegrationTest, client_context, unittest
31+
from test import IntegrationTest, client_context, skip_if_rust_bson, unittest
3232

3333
from bson import (
3434
_BUILT_IN_TYPES,
@@ -211,6 +211,7 @@ def setUpClass(cls):
211211
cls.codecopts = codec_options
212212

213213

214+
@skip_if_rust_bson
214215
class TestBSONFallbackEncoder(unittest.TestCase):
215216
def _get_codec_options(self, fallback_encoder):
216217
type_registry = TypeRegistry(fallback_encoder=fallback_encoder)
@@ -336,6 +337,7 @@ def test_type_checks(self):
336337
self.assertFalse(issubclass(TypeEncoder, TypeDecoder))
337338

338339

340+
@skip_if_rust_bson
339341
class TestBSONCustomTypeEncoderAndFallbackEncoderTandem(unittest.TestCase):
340342
TypeA: Any
341343
TypeB: Any
@@ -622,6 +624,7 @@ class MyType(pytype): # type: ignore
622624
run_test(TypeCodec, {"bson_type": Decimal128, "transform_bson": lambda x: x})
623625

624626

627+
@skip_if_rust_bson
625628
class TestCollectionWCustomType(IntegrationTest):
626629
def setUp(self):
627630
super().setUp()

test/test_raw_bson.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
sys.path[0:0] = [""]
2121

22-
from test import IntegrationTest, client_context, unittest
22+
from test import IntegrationTest, client_context, skip_if_rust_bson, unittest
2323

2424
from bson import Code, DBRef, decode, encode
2525
from bson.binary import JAVA_LEGACY, Binary, UuidRepresentation
@@ -31,6 +31,7 @@
3131
_IS_SYNC = True
3232

3333

34+
@skip_if_rust_bson
3435
class TestRawBSONDocument(IntegrationTest):
3536
# {'_id': ObjectId('556df68b6e32ab21a95e0785'),
3637
# 'name': 'Sherlock',

0 commit comments

Comments
 (0)