From b351bc6c8fa72d2de84ac82aefe3d5a20a53c386 Mon Sep 17 00:00:00 2001 From: Matthew Treinish Date: Sat, 15 Aug 2015 14:41:22 -0400 Subject: [PATCH] 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 --- os_testr/subunit_trace.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/os_testr/subunit_trace.py b/os_testr/subunit_trace.py index 2af7376..003299f 100755 --- a/os_testr/subunit_trace.py +++ b/os_testr/subunit_trace.py @@ -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])