def build(self): """ A contextmanager that returns a MongoContentStore, and deletes its contents when the context closes. """ contentstore = MongoContentStore(db=f'contentstore{THIS_UUID}', collection='content', **COMMON_DOCSTORE_CONFIG) contentstore.ensure_indexes() try: yield contentstore finally: # Delete the created database contentstore._drop_database() # pylint: disable=protected-access
def build(self): """ A contextmanager that returns a MongoContentStore, and deletes its contents when the context closes. """ contentstore = MongoContentStore(db='contentstore{}'.format( random.randint(0, 10000)), collection='content', **COMMON_DOCSTORE_CONFIG) contentstore.ensure_indexes() try: yield contentstore finally: # Delete the created database contentstore._drop_database()
def build(self): """ A contextmanager that returns a MongoContentStore, and deletes its contents when the context closes. """ contentstore = MongoContentStore( db='contentstore{}'.format(random.randint(0, 10000)), collection='content', **COMMON_DOCSTORE_CONFIG ) contentstore.ensure_indexes() try: yield contentstore finally: # Delete the created database contentstore._drop_database()
def build(self): """ A contextmanager that returns a MongoContentStore, and deletes its contents when the context closes. """ contentstore = MongoContentStore( db='contentstore{}'.format(THIS_UUID), collection='content', **COMMON_DOCSTORE_CONFIG ) contentstore.ensure_indexes() try: yield contentstore finally: # Delete the created database contentstore._drop_database() # pylint: disable=protected-access