286
by mattgiuca
test_framework: Added test_json, a version of test.py which outputs JSON |
1 |
import sys |
1801.1.1
by William Grant
Replace cjson with json, or simplejson if json is not available (Python <2.6) |
2 |
|
3 |
try: |
|
4 |
import json |
|
5 |
except ImportError: |
|
6 |
import simplejson as json |
|
7 |
||
286
by mattgiuca
test_framework: Added test_json, a version of test.py which outputs JSON |
8 |
sys.path.append('../../www/apps/tutorial/test/') |
9 |
||
10 |
from parse_tute import * |
|
11 |
||
12 |
for i in range(1, len(sys.argv)): |
|
13 |
basename = sys.argv[i] |
|
14 |
xmlfile = basename + '_text.xml' |
|
15 |
pyfile = basename + '.py' |
|
16 |
jobj = {"problem": basename} |
|
17 |
||
513
by stevenbird
test/test_framework/*, exercises/sample/* |
18 |
problem_suite = parse_exercise_file(xmlfile) |
286
by mattgiuca
test_framework: Added test_json, a version of test.py which outputs JSON |
19 |
jobj['name'], results = problem_suite.run_tests(pyfile) |
20 |
jobj['cases'] = results |
|
21 |
||
1801.1.1
by William Grant
Replace cjson with json, or simplejson if json is not available (Python <2.6) |
22 |
print json.dumps(jobj) |