Skip to content

Commit 06b32a0

Browse files
committed
PYTHON-1003 Test _list_collections uses one socket at a time.
1 parent dc70912 commit 06b32a0

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

test/test_database.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,17 @@ def test_collection_names(self):
173173
finally:
174174
self.client.drop_database("many_collections")
175175

176+
def test_collection_names_single_socket(self):
177+
# Test that Database.collection_names only requires one socket.
178+
client = rs_or_single_client(maxPoolSize=1)
179+
client.drop_database('test_collection_names_single_socket')
180+
db = client.test_collection_names_single_socket
181+
for i in range(200):
182+
db.create_collection(str(i))
183+
184+
db.collection_names() # Must not hang.
185+
client.drop_database('test_collection_names_single_socket')
186+
176187
def test_drop_collection(self):
177188
db = Database(self.client, "pymongo_test")
178189

0 commit comments

Comments
 (0)