Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
add async mongo client fixture
  • Loading branch information
assigdev committed Oct 4, 2018
commit 5fb492b18a789264620c9938f4cc529a731add3f
9 changes: 9 additions & 0 deletions pytest_async_mongodb/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,15 @@ async def async_mongodb(pytestconfig):
return db


@pytest.fixture(scope='function')
async def async_mongodb_client(pytestconfig):
client = AsyncMockMongoClient()
db = client['pytest']
await clean_database(db)
await load_fixtures(db, pytestconfig)
return client


async def clean_database(db):
collections = await db.collection_names(include_system_collections=False)
for name in collections:
Expand Down