From 06b32a00ab5f0c8b0ba96e2c92bf7ee8a741e25b Mon Sep 17 00:00:00 2001 From: "A. Jesse Jiryu Davis" Date: Fri, 16 Oct 2015 16:25:56 -0400 Subject: [PATCH] PYTHON-1003 Test _list_collections uses one socket at a time. --- test/test_database.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/test/test_database.py b/test/test_database.py index 06cba66b2..d92c3a6cf 100644 --- a/test/test_database.py +++ b/test/test_database.py @@ -173,6 +173,17 @@ class TestDatabase(IntegrationTest): finally: self.client.drop_database("many_collections") + def test_collection_names_single_socket(self): + # Test that Database.collection_names only requires one socket. + client = rs_or_single_client(maxPoolSize=1) + client.drop_database('test_collection_names_single_socket') + db = client.test_collection_names_single_socket + for i in range(200): + db.create_collection(str(i)) + + db.collection_names() # Must not hang. + client.drop_database('test_collection_names_single_socket') + def test_drop_collection(self): db = Database(self.client, "pymongo_test")