We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents d02ad10 + df2eb58 commit 75e04ebCopy full SHA for 75e04eb
pytest-server-fixtures/pytest_server_fixtures/mongo.py
@@ -127,9 +127,9 @@ def check_server_up(self):
127
128
log.info("Connecting to Mongo at %s:%s" % (self.hostname, self.port))
129
try:
130
- self.api = pymongo.MongoClient(self.hostname, self.port,
131
- serverselectiontimeoutms=200)
132
- self.api.list_database_names()
+ with pymongo.MongoClient(self.hostname, self.port, serverselectiontimeoutms=200) as initial_api:
+ initial_api.list_database_names()
+
133
# Configure the client with default timeouts in case the server goes slow
134
self.api = pymongo.MongoClient(self.hostname, self.port)
135
return True
0 commit comments