#NEWLINE# def test_exception_on_config_callback( self ) : #NEWLINE# #INDENT# "\n        When config's callback has exception, It should not prevent other\n        watchers from getting notified.\n        " #NEWLINE# ( fd , tmp_file ) = tempfile . mkstemp ( ) #NEWLINE# def on_change1( value , stat ) : #NEWLINE# #INDENT# raise Exception #NEWLINE# #UNINDENT# test_data2 = [ 0 , None , None ] #NEWLINE# def on_change2( value , stat ) : #NEWLINE# #INDENT# test_data2 [ 0 ] += 1 #NEWLINE# test_data2 [ 1 ] = value #NEWLINE# test_data2 [ 2 ] = stat . version #NEWLINE# #UNINDENT# new_content = 'hello' #NEWLINE# watch = FileWatch ( polling = False ) #NEWLINE# watch . _clear_all_watches ( ) #NEWLINE# self . _validate_empty_internal_map ( watch ) #NEWLINE# watch . add_watch ( tmp_file , on_change1 ) #NEWLINE# self . _validate_internal_map ( watch , tmp_file , 'config' , 1 ) #NEWLINE# watch . add_watch ( tmp_file , on_change2 ) #NEWLINE# self . _validate_internal_map ( watch , tmp_file , 'config' , 2 ) #NEWLINE# time . sleep ( 1 ) #NEWLINE# f = open ( tmp_file , 'w' ) #NEWLINE# f . write ( new_content ) #NEWLINE# f . close ( ) #NEWLINE# watch . _check_file_updates ( ) #NEWLINE# self . _validate_internal_map ( watch , tmp_file , 'config' , 2 ) #NEWLINE# self . assertEqual ( test_data2 [ 0 ] , 2 ) #NEWLINE# self . assertEqual ( test_data2 [ 1 ] , new_content ) #NEWLINE# self . assertEqual ( test_data2 [ 2 ] , os . path . getmtime ( tmp_file ) ) #NEWLINE# del watch #NEWLINE# os . remove ( tmp_file )