summaryrefslogtreecommitdiff
path: root/tests/test_pretty_print.py
diff options
context:
space:
mode:
authorMarius Kintel <marius@kintel.net>2011-12-23 20:14:12 (GMT)
committerMarius Kintel <marius@kintel.net>2011-12-23 20:14:12 (GMT)
commitd6efe5cbcb99f7730b47b5945f305f08b5d21b94 (patch)
treeeb429be5acf82a5710d9879dd5fd00b62f1788b7 /tests/test_pretty_print.py
parent87ce149df2581361e8975bd1a0addf2b6ef61e3d (diff)
parent10c96326866c8256e82f0092a18f4f4e3ca06a74 (diff)
Merge branch 'master' into boost_filesystem
Conflicts: tests/CMakeLists.txt
Diffstat (limited to 'tests/test_pretty_print.py')
-rwxr-xr-xtests/test_pretty_print.py26
1 files changed, 14 insertions, 12 deletions
diff --git a/tests/test_pretty_print.py b/tests/test_pretty_print.py
index 53fcc37..5e25052 100755
--- a/tests/test_pretty_print.py
+++ b/tests/test_pretty_print.py
@@ -151,14 +151,14 @@ def parsetest(teststring):
"Test time.*?Test (Passed)", # pass/fail
"Output:(.*?)<end of output>",
'Command:.*?-s" "(.*?)"', # type
- "actual .*?:(.*?)\n",
- "expected .*?:(.*?)\n",
+ "^ actual .*?:(.*?)\n",
+ "^ expected .*?:(.*?)\n",
'Command:.*?(testdata.*?)"' # scadfile
]
hits = map( lambda pattern: ezsearch(pattern,teststring), patterns )
test = Test(hits[0],hits[1],hits[2]=='Passed',hits[3],hits[4],hits[5],hits[6],hits[7],teststring)
- test.actualfile_data = tryread(test.actualfile)
- test.expectedfile_data = tryread(test.expectedfile)
+ if len(test.actualfile) > 0: test.actualfile_data = tryread(test.actualfile)
+ if len(test.expectedfile) > 0: test.expectedfile_data = tryread(test.expectedfile)
return test
def parselog(data):
@@ -249,8 +249,8 @@ TESTLOG
passed_tests = filter(lambda x: x.passed, tests)
failed_tests = filter(lambda x: not x.passed, tests)
- tests_to_report = tests
- if failed_only: tests_to_report = failed_tests
+ tests_to_report = failed_tests
+ if include_passed: tests_to_report = tests
try: percent = str(int(100.0*len(passed_tests) / len(tests)))
except ZeroDivisionError: percent = 'n/a'
@@ -274,10 +274,12 @@ TESTLOG
wikiname_a = wikify_filename(tmp,wiki_rootpath,sysid)
tmp = t.expectedfile.replace(os.path.dirname(builddir),'')
wikiname_e = wikify_filename(tmp,wiki_rootpath,sysid)
- imgs[wikiname_e] = t.expectedfile_data
+ if hasattr(t, 'expectedfile_data'):
+ imgs[wikiname_e] = t.expectedfile_data
if t.actualfile:
actualfile_wiki = '[[File:'+wikiname_a+'|250px]]'
- imgs[wikiname_a] = t.actualfile_data
+ if hasattr(t, 'actualfile_data'):
+ imgs[wikiname_a] = t.actualfile_data
else:
actualfile_wiki = 'No image generated.'
newchunk = re.sub('FTESTNAME',t.fullname,repeat1)
@@ -317,8 +319,8 @@ def tohtml(wiki_rootpath, startdate, tests, enddate, sysinfo, sysid, makefiles):
try: percent = str(int(100.0*len(passed_tests) / len(tests)))
except ZeroDivisionError: percent = 'n/a'
- tests_to_report = tests
- if failed_only: tests_to_report = failed_tests
+ tests_to_report = failed_tests
+ if include_passed: tests_to_report = tests
s=''
@@ -497,7 +499,7 @@ maxretry = 10
if bool(os.getenv("TEST_GENERATE")): sys.exit(0)
-failed_only = False
-if '--failed-only' in sys.argv: failed_only = True
+include_passed = False
+if '--include-passed' in sys.argv: include_passed = True
main()
contact: Jan Huwald // Impressum