Skip to content

Commit c6ad26c

Browse files
committed
ensure coll created
1 parent 9dc1562 commit c6ad26c

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

test/test_unified_format.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,7 @@
3232
module=__name__,
3333
class_name_prefix='UnifiedTestFormat',
3434
expected_failures=[
35-
'Client side error in command starting transaction', # PYTHON-1894
36-
'InsertOne fails after multiple retryable writeConcernErrors' # PYTHON-2452
35+
'Client side error in command starting transaction', # PYTHON-1894
3736
]))
3837

3938

test/unified_format.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -526,9 +526,12 @@ def insert_initial_data(self, initial_data):
526526
coll_name, write_concern=WriteConcern(w="majority"))
527527
coll.drop()
528528

529-
# documents MAY be an empty list
530-
if len(documents):
529+
if len(documents) > 0:
531530
coll.insert_many(documents)
531+
else:
532+
# ensure collection exists
533+
result = coll.insert_one({})
534+
coll.delete_one({'_id': result.inserted_id})
532535

533536
@classmethod
534537
def setUpClass(cls):

0 commit comments

Comments
 (0)