mongodb-labs / python-bsonjs

A fast BSON to MongoDB Extended JSON converter for Python - This Repository is NOT a supported MongoDB product
Apache License 2.0
40 stars 10 forks source link

Vendor libbson 1.17 #19

Closed juliusgeo closed 4 years ago

ShaneHarvey commented 4 years ago

The remaining work here is to understand (and fix) these test failures:

ERROR: test_regex (test.test_bsonjs.TestBsonjs)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/travis/build/mongodb-labs/python-bsonjs/test/test_bsonjs.py", line 147, in test_regex
    res = bsonjs_loads('{"r": {"$regex": "a*b"}}')['r']
  File "/home/travis/build/mongodb-labs/python-bsonjs/test/test_bsonjs.py", line 63, in bsonjs_loads
    return to_object(bsonjs.loads(json_str))
ValueError: Missing "$options" after "$regex"
======================================================================
FAIL: test_binary (test.test_bsonjs.TestBsonjs)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/travis/build/mongodb-labs/python-bsonjs/test/test_bsonjs.py", line 191, in test_binary
    self.round_trip(bin_type_dict)
  File "/home/travis/build/mongodb-labs/python-bsonjs/test/test_bsonjs.py", line 78, in round_trip
    json_options=json_util.STRICT_JSON_OPTIONS))
AssertionError: {'bin': Binary(b'\x00\x01\x02\x03\x04', 0)} != {'bin': b'\x00\x01\x02\x03\x04'}
- {'bin': Binary(b'\x00\x01\x02\x03\x04', 0)}
?         -------                       ----
+ {'bin': b'\x00\x01\x02\x03\x04'}
======================================================================
FAIL: test_load_mongodb_extended_type_at_top_level (test.test_bsonjs.TestBsonjs)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/travis/build/mongodb-labs/python-bsonjs/test/test_bsonjs.py", line 236, in test_load_mongodb_extended_type_at_top_level
    '{"$numberLong": "42"}')
AssertionError: ValueError not raised by loads

The test_binary is failing in master so I think that is caused by a pymongo change. test_regex looks like it may be a bug in libbson. Can you raise that issue with the C driver team (open a CDRIVER ticket)? test_load_mongodb_extended_type_at_top_level might be an intentional change in libbson, let's adjust the test accordingly. For reference, most projects maintain a changelog which highlights changes across releases. You can scan the libbson changelog here: https://github.com/mongodb/mongo-c-driver/blob/1.17.0/src/libbson/NEWS

It would also be great if you could remove all mention of git submodules from the README.

ShaneHarvey commented 4 years ago

Do we also need to update the bson-config.h and bson-version.h files?

juliusgeo commented 4 years ago

The remaining work here is to understand (and fix) these test failures:

ERROR: test_regex (test.test_bsonjs.TestBsonjs)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/travis/build/mongodb-labs/python-bsonjs/test/test_bsonjs.py", line 147, in test_regex
    res = bsonjs_loads('{"r": {"$regex": "a*b"}}')['r']
  File "/home/travis/build/mongodb-labs/python-bsonjs/test/test_bsonjs.py", line 63, in bsonjs_loads
    return to_object(bsonjs.loads(json_str))
ValueError: Missing "$options" after "$regex"
======================================================================
FAIL: test_binary (test.test_bsonjs.TestBsonjs)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/travis/build/mongodb-labs/python-bsonjs/test/test_bsonjs.py", line 191, in test_binary
    self.round_trip(bin_type_dict)
  File "/home/travis/build/mongodb-labs/python-bsonjs/test/test_bsonjs.py", line 78, in round_trip
    json_options=json_util.STRICT_JSON_OPTIONS))
AssertionError: {'bin': Binary(b'\x00\x01\x02\x03\x04', 0)} != {'bin': b'\x00\x01\x02\x03\x04'}
- {'bin': Binary(b'\x00\x01\x02\x03\x04', 0)}
?         -------                       ----
+ {'bin': b'\x00\x01\x02\x03\x04'}
======================================================================
FAIL: test_load_mongodb_extended_type_at_top_level (test.test_bsonjs.TestBsonjs)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/travis/build/mongodb-labs/python-bsonjs/test/test_bsonjs.py", line 236, in test_load_mongodb_extended_type_at_top_level
    '{"$numberLong": "42"}')
AssertionError: ValueError not raised by loads

The test_binary is failing in master so I think that is caused by a pymongo change. test_regex looks like it may be a bug in libbson. Can you raise that issue with the C driver team (open a CDRIVER ticket)? test_load_mongodb_extended_type_at_top_level might be an intentional change in libbson, let's adjust the test accordingly. For reference, most projects maintain a changelog which highlights changes across releases. You can scan the libbson changelog here: https://github.com/mongodb/mongo-c-driver/blob/1.17.0/src/libbson/NEWS

It would also be great if you could remove all mention of git submodules from the README.

https://jira.mongodb.org/browse/CDRIVER-3773 Opened a new ticket here. Will remove references of git submodules from README.

juliusgeo commented 4 years ago

Do we also need to update the bson-config.h and bson-version.h files?

I updated them.

juliusgeo commented 4 years ago

Still need to fix this test failure:

FAIL: test_load_mongodb_extended_type_at_top_level (test.test_bsonjs.TestBsonjs)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/src/test/test_bsonjs.py", line 237, in test_load_mongodb_extended_type_at_top_level
    '{"$numberLong": "42"}')
AssertionError: ValueError not raised by loads

I believe I have fixed it.