#NEWLINE# def Generate( self , project_configuration , output_writer ) : #NEWLINE# #INDENT# 'Generates tests source files.\n\n    Args:\n      project_configuration: the project configuration (instance of\n                             ProjectConfiguration).\n      output_writer: an output writer object (instance of OutputWriter).\n    ' #NEWLINE# tests_path = os . path . join ( self . _projects_directory , project_configuration . library_name , 'tests' ) #NEWLINE# if ( not os . path . exists ( tests_path ) ) : #NEWLINE# #INDENT# return #NEWLINE# #UNINDENT# library_header = 'yal_test_{0:s}.h' . format ( project_configuration . library_name ) #NEWLINE# template_mappings = project_configuration . GetTemplateMappings ( ) #NEWLINE# template_mappings [ 'library_public_types' ] = ' ' . join ( project_configuration . library_public_types ) #NEWLINE# for directory_entry in os . listdir ( self . _template_directory ) : #NEWLINE# #INDENT# if ( directory_entry == library_header ) : #NEWLINE# #INDENT# continue #NEWLINE# #UNINDENT# template_filename = os . path . join ( self . _template_directory , directory_entry ) #NEWLINE# if ( not os . path . isfile ( template_filename ) ) : #NEWLINE# #INDENT# continue #NEWLINE# #UNINDENT# if ( directory_entry == 'yal_test_libyal.h' ) : #NEWLINE# #INDENT# output_filename = '{0:s}_test_{1:s}.h' . format ( project_configuration . library_name_suffix , project_configuration . library_name ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if directory_entry . startswith ( 'yal_test_' ) : #NEWLINE# #INDENT# output_filename = '{0:s}_{1:s}' . format ( project_configuration . library_name_suffix , directory_entry [ 4 : ] ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if directory_entry . startswith ( 'pyyal_test_' ) : #NEWLINE# #INDENT# output_filename = '{0:s}_{1:s}' . format ( project_configuration . python_module_name , directory_entry [ 6 : ] ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( directory_entry . startswith ( 'test_yal' ) and directory_entry . endswith ( '.sh' ) ) : #NEWLINE# #INDENT# output_filename = 'test_{0:s}{1:s}' . format ( project_configuration . library_name_suffix , directory_entry [ 8 : ] ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( directory_entry . startswith ( 'test_pyyal' ) and directory_entry . endswith ( '.sh' ) ) : #NEWLINE# #INDENT# output_filename = 'test_{0:s}{1:s}' . format ( project_configuration . python_module_name , directory_entry [ 10 : ] ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# output_filename = directory_entry #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# output_filename = os . path . join ( 'tests' , output_filename ) #NEWLINE# if ( not os . path . exists ( output_filename ) ) : #NEWLINE# #INDENT# continue #NEWLINE# #UNINDENT# self . _GenerateSection ( template_filename , template_mappings , output_writer , output_filename )