#NEWLINE# def generate_tests( cls ) : #NEWLINE# #INDENT# "Add test methods to this class for each test file in\n        `cls.cases_dir'.\n        " #NEWLINE# cases_pat = join ( dirname ( __file__ ) , cls . cases_dir , '*.text' ) #NEWLINE# for text_path in glob ( cases_pat ) : #NEWLINE# #INDENT# opts = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# opts_path = ( splitext ( text_path ) [ 0 ] + '.opts' ) #NEWLINE# if exists ( opts_path ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# opts = eval ( open ( opts_path , 'r' ) . read ( ) ) #NEWLINE# #UNINDENT# except Exception : #NEWLINE# #INDENT# ( _ , ex , _ ) = sys . exc_info ( ) #NEWLINE# print ( ( "WARNING: couldn't load `%s' opts file: %s" % ( opts_path , ex ) ) ) #NEWLINE# #UNINDENT# #UNINDENT# toc_html_path = ( splitext ( text_path ) [ 0 ] + '.toc_html' ) #NEWLINE# if ( not exists ( toc_html_path ) ) : #NEWLINE# #INDENT# toc_html_path = None #NEWLINE# #UNINDENT# metadata_path = ( splitext ( text_path ) [ 0 ] + '.metadata' ) #NEWLINE# if ( not exists ( metadata_path ) ) : #NEWLINE# #INDENT# metadata_path = None #NEWLINE# #UNINDENT# test_func = ( lambda self , t = text_path , o = opts , c = toc_html_path , m = metadata_path : self . _assertMarkdownPath ( t , opts = o , toc_html_path = c , metadata_path = m ) ) #NEWLINE# tags_path = ( splitext ( text_path ) [ 0 ] + '.tags' ) #NEWLINE# if exists ( tags_path ) : #NEWLINE# #INDENT# tags = [ ] #NEWLINE# for line in open ( tags_path ) : #NEWLINE# #INDENT# if ( '#' in line ) : #NEWLINE# #INDENT# line = line [ : line . index ( '#' ) ] #NEWLINE# #UNINDENT# tags += line . split ( ) #NEWLINE# #UNINDENT# test_func . tags = tags #NEWLINE# #UNINDENT# name = splitext ( basename ( text_path ) ) [ 0 ] #NEWLINE# name = name . replace ( ' - ' , '_' ) #NEWLINE# name = name . replace ( ' ' , '_' ) #NEWLINE# name = re . sub ( '[(),]' , '' , name ) #NEWLINE# test_name = ( 'test_%s' % name ) #NEWLINE# setattr ( cls , test_name , test_func )