286
by mattgiuca
test_framework: Added test_json, a version of test.py which outputs JSON |
1 |
import cjson |
2 |
import sys |
|
3 |
sys.path.append('../../www/apps/tutorial/test/') |
|
4 |
||
5 |
from parse_tute import * |
|
6 |
||
7 |
for i in range(1, len(sys.argv)): |
|
8 |
basename = sys.argv[i] |
|
9 |
xmlfile = basename + '_text.xml' |
|
10 |
pyfile = basename + '.py' |
|
11 |
jobj = {"problem": basename} |
|
12 |
||
13 |
problem_suite = parse_tutorial_file(xmlfile) |
|
14 |
jobj['name'], results = problem_suite.run_tests(pyfile) |
|
15 |
jobj['cases'] = results |
|
16 |
||
17 |
print cjson.encode(jobj) |