Skip to content

Commit

Permalink
Fixed warning about an unclosed MongoClient
Browse files Browse the repository at this point in the history
  • Loading branch information
agronholm committed Sep 22, 2024
1 parent 90a775c commit 0bcb319
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions tests/test_datastores.py
Original file line number Diff line number Diff line change
Expand Up @@ -857,5 +857,8 @@ async def test_psycopg(self) -> None:
)

async def test_mongodb(self) -> None:
data_store = MongoDBDataStore("mongodb://localhost")
assert repr(data_store) == "MongoDBDataStore(host=[('localhost', 27017)])"
from pymongo import MongoClient

with MongoClient() as client:
data_store = MongoDBDataStore(client)
assert repr(data_store) == "MongoDBDataStore(host=[('localhost', 27017)])"

0 comments on commit 0bcb319

Please sign in to comment.