def setup_class(cls): unique_name = os.urandom(8).hex() cls.db_filename = DatabaseContext.shared_memory_uri(unique_name) cls.db_context = DatabaseContext(cls.db_filename) # We hold onto an open connection to ensure that the database persists for the # lifetime of the tests. cls.db = cls.db_context.acquire_connection() create_database(cls.db) update_database(cls.db) cls.store = wallet_database.WalletDataTable(cls.db_context)
def get_db_context(self): return DatabaseContext(self.path)
def _db_context(): wallet_path = os.path.join(tempfile.mkdtemp(), "wallet_create") assert not os.path.exists(wallet_path) migration.create_database_file(wallet_path) return DatabaseContext(wallet_path)