#NEWLINE# def test_serverset_content_not_change( self ) : #NEWLINE# #INDENT# '\n        When monitored serverset has mtime changed but not the content,\n        callback should not be triggered.\n        ' #NEWLINE# ( fd , tmp_file ) = tempfile . mkstemp ( ) #NEWLINE# test_data = [ 0 , None ] #NEWLINE# def on_change( value ) : #NEWLINE# #INDENT# test_data [ 0 ] += 1 #NEWLINE# test_data [ 1 ] = value #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_change , watch_type = 'serverset' ) #NEWLINE# self . _validate_internal_map ( watch , tmp_file , 'serverset' , 1 ) #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 , 'serverset' , 1 ) #NEWLINE# old_update_time = os . path . getmtime ( tmp_file ) #NEWLINE# self . assertEqual ( test_data [ 0 ] , 2 ) #NEWLINE# self . assertEqual ( test_data [ 1 ] , [ new_content ] ) #NEWLINE# time . sleep ( 1 ) #NEWLINE# f = open ( tmp_file , 'w' ) #NEWLINE# f . write ( new_content ) #NEWLINE# f . close ( ) #NEWLINE# new_update_time = os . path . getmtime ( tmp_file ) #NEWLINE# self . assertNotEqual ( old_update_time , new_update_time ) #NEWLINE# watch . _check_file_updates ( ) #NEWLINE# self . _validate_internal_map ( watch , tmp_file , 'serverset' , 1 ) #NEWLINE# self . assertEqual ( test_data [ 0 ] , 2 ) #NEWLINE# self . assertEqual ( test_data [ 1 ] , [ new_content ] ) #NEWLINE# del watch #NEWLINE# os . remove ( tmp_file )