Handle a skipped test without a reason message

This commit fixes a bug in subunit-trace where if a test is skipped
but does not have a reason associated with the skip it would stack
trace. This checks for the existence of a reason before trying to
use it.

Change-Id: I14dd9fbb40a8c232431e5042aa46f7e521e15311
This commit is contained in:
Matthew Treinish 2015-08-15 14:41:22 -04:00
parent dcb8ea833c
commit b351bc6c8f
No known key found for this signature in database
GPG Key ID: FD12A0F214C9E177
1 changed files with 5 additions and 2 deletions

View File

@ -194,8 +194,11 @@ def show_outcome(stream, test, print_failures=False, failonly=False,
if abbreviate:
stream.write('S')
else:
stream.write('{%s} %s ... SKIPPED: %s\n' % (
worker, name, test['details']['reason'].as_text()))
reason = test['details'].get('reason', '')
if reason:
reason = ': ' + reason.as_text()
stream.write('{%s} %s ... SKIPPED%s\n' % (
worker, name, reason))
else:
if abbreviate:
stream.write('%s' % test['status'][0])