#NEWLINE# def test_ensure_purge_index_threaded( self ) : #NEWLINE# #INDENT# coll = threads . db . threaded_index_creation #NEWLINE# class Indexer ( threading . Thread ) : #NEWLINE# #INDENT# def run( self ) : #NEWLINE# #INDENT# coll . ensure_index ( 'foo' ) #NEWLINE# try : #NEWLINE# #INDENT# coll . drop_index ( 'foo' ) #NEWLINE# #UNINDENT# except OperationFailure : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# coll . ensure_index ( 'foo' ) #NEWLINE# coll . drop_indexes ( ) #NEWLINE# coll . create_index ( 'foo' ) #NEWLINE# #UNINDENT# #UNINDENT# try : #NEWLINE# #INDENT# threads = [ ] #NEWLINE# for _ in range ( 10 ) : #NEWLINE# #INDENT# t = Indexer ( ) #NEWLINE# t . setDaemon ( True ) #NEWLINE# threads . append ( t ) #NEWLINE# #UNINDENT# for thread in threads : #NEWLINE# #INDENT# thread . start ( ) #NEWLINE# #UNINDENT# joinall ( threads ) #NEWLINE# self . assertTrue ( ( 'foo_1' in coll . index_information ( ) ) ) #NEWLINE# #UNINDENT# finally : #NEWLINE# #INDENT# coll . drop ( )