Skip to content

Commit a0e9d61

Browse files
authored
PYTHON-3747 Fix flaky test_list_databases (#1403)
1 parent 19c5fcf commit a0e9d61

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

test/test_client.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -794,13 +794,11 @@ def test_list_databases(self):
794794
self.assertIsInstance(cursor, CommandCursor)
795795
helper_docs = list(cursor)
796796
self.assertTrue(len(helper_docs) > 0)
797-
# sizeOnDisk can change between calls.
798-
for doc_list in (helper_docs, cmd_docs):
799-
for doc in doc_list:
800-
doc.pop("sizeOnDisk", None)
801-
self.assertEqual(helper_docs, cmd_docs)
802-
for doc in helper_docs:
803-
self.assertIs(type(doc), dict)
797+
self.assertEqual(len(helper_docs), len(cmd_docs))
798+
# PYTHON-3529 Some fields may change between calls, just compare names.
799+
for helper_doc, cmd_doc in zip(helper_docs, cmd_docs):
800+
self.assertIs(type(helper_doc), dict)
801+
self.assertEqual(helper_doc.keys(), cmd_doc.keys())
804802
client = rs_or_single_client(document_class=SON)
805803
self.addCleanup(client.close)
806804
for doc in client.list_databases():

0 commit comments

Comments
 (0)