#NEWLINE# def _CreateTestFile( self , file_type , path , contents = None ) : #NEWLINE# #INDENT# 'Create a dir, file, or link in both the real fs and the fake.' #NEWLINE# path = Sep ( path ) #NEWLINE# self . _created_files . append ( [ file_type , path , contents ] ) #NEWLINE# ( real_path , fake_path ) = self . _Paths ( path ) #NEWLINE# if ( file_type == 'd' ) : #NEWLINE# #INDENT# os . mkdir ( real_path ) #NEWLINE# self . fake_os . mkdir ( fake_path ) #NEWLINE# #UNINDENT# if ( file_type == 'f' ) : #NEWLINE# #INDENT# fh = open ( real_path , 'w' ) #NEWLINE# fh . write ( ( contents or '' ) ) #NEWLINE# fh . close ( ) #NEWLINE# fh = self . fake_open ( fake_path , 'w' ) #NEWLINE# fh . write ( ( contents or '' ) ) #NEWLINE# fh . close ( ) #NEWLINE# #UNINDENT# if ( file_type == 'b' ) : #NEWLINE# #INDENT# fh = open ( real_path , 'wb' ) #NEWLINE# fh . write ( ( contents or '' ) ) #NEWLINE# fh . close ( ) #NEWLINE# fh = self . fake_open ( fake_path , 'wb' ) #NEWLINE# fh . write ( ( contents or '' ) ) #NEWLINE# fh . close ( ) #NEWLINE# #UNINDENT# if ( file_type in ( 'l' , 'h' ) ) : #NEWLINE# #INDENT# ( real_target , fake_target ) = ( contents , contents ) #NEWLINE# if contents . startswith ( os . sep ) : #NEWLINE# #INDENT# ( real_target , fake_target ) = self . _Paths ( contents [ 1 : ] ) #NEWLINE# #UNINDENT# if ( file_type == 'l' ) : #NEWLINE# #INDENT# os . symlink ( real_target , real_path ) #NEWLINE# self . fake_os . symlink ( fake_target , fake_path ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( file_type == 'h' ) : #NEWLINE# #INDENT# os . link ( real_target , real_path ) #NEWLINE# self . fake_os . link ( fake_target , fake_path )