diff options
author | Marius Kintel <marius@kintel.net> | 2011-12-21 16:42:11 (GMT) |
---|---|---|
committer | Marius Kintel <marius@kintel.net> | 2011-12-21 16:42:11 (GMT) |
commit | 9113cf42d08e828a2ba7c4e40ac24a937f17b306 (patch) | |
tree | 0b0072e456d14a0813f7c79a471774759c040e63 /tests/test_pretty_print.py | |
parent | 0e59b194abbe5b261e5aa8ca9fcaaffc6b019b01 (diff) |
Handle missing expected files gracefully
Diffstat (limited to 'tests/test_pretty_print.py')
-rwxr-xr-x | tests/test_pretty_print.py | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/tests/test_pretty_print.py b/tests/test_pretty_print.py index 7407b15..87ac3df 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.actualfile) > 0: test.expectedfile_data = tryread(test.expectedfile) return test def parselog(data): @@ -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) |