4 # Generate an HTML file for each .test file in the current directory
7 TEST_LIST_FILE
= '00_test_list.txt';
8 TEMPLATE
= 'template.html';
10 def genHTML(template
, test
):
11 contents
= re
.sub('___TEST_NAME___', "'" + test
+ "'", template
);
12 filename
= test
+ '.html';
13 print "Generating " + filename
;
14 with
open(test
+ '.html', 'w') as f
:
19 def process_test_files(template
):
21 files
= os
.listdir(os
.getcwd());
23 found
= re
.search('(^[^.].*)\.test$', file);
25 generated
.append(genHTML(template
,found
.group(1)));
30 with
open(TEMPLATE
, 'r') as f
:
35 template
= readTemplate();
37 test_list
= process_test_files(template
);
38 print "Generating " + TEST_LIST_FILE
;
39 with
open(TEST_LIST_FILE
, 'w') as f
:
40 for item
in test_list
:
43 print "Couldn't find template file: " + TEMPLATE
;