Commit eb68f261 authored by Denis Bilenko's avatar Denis Bilenko

testrunner.py: do not report skipped tests

parent c33de650
...@@ -41,6 +41,8 @@ DEFAULT_TIMEOUT = 60 ...@@ -41,6 +41,8 @@ DEFAULT_TIMEOUT = 60
# the number of bytes of output that is recorded; the rest is thrown away # the number of bytes of output that is recorded; the rest is thrown away
OUTPUT_LIMIT = 15*1024 OUTPUT_LIMIT = 15*1024
ignore_tracebacks = ['ExpectedException', 'test_support.TestSkipped', 'test.test_support.TestSkipped']
import sys import sys
import os import os
import glob import glob
...@@ -239,6 +241,7 @@ def run_subprocess(arg, options): ...@@ -239,6 +241,7 @@ def run_subprocess(arg, options):
timeout = Timer(options.timeout, killer) timeout = Timer(options.timeout, killer)
timeout.start() timeout.start()
output = '' output = ''
output_printed = False
try: try:
try: try:
if options.capture: if options.capture:
...@@ -249,6 +252,7 @@ def run_subprocess(arg, options): ...@@ -249,6 +252,7 @@ def run_subprocess(arg, options):
output += data output += data
if options.verbosity >= 2: if options.verbosity >= 2:
sys.stdout.write(data) sys.stdout.write(data)
output_printed = True
retcode.append(popen.wait()) retcode.append(popen.wait())
except Exception: except Exception:
popen.kill() popen.kill()
...@@ -260,7 +264,6 @@ def run_subprocess(arg, options): ...@@ -260,7 +264,6 @@ def run_subprocess(arg, options):
if module_name.endswith('.py'): if module_name.endswith('.py'):
module_name = module_name[:-3] module_name = module_name[:-3]
output = output.replace(' (__main__.', ' (' + module_name + '.') output = output.replace(' (__main__.', ' (' + module_name + '.')
output_printed = options.verbosity >= 2
return retcode[0], output, output_printed return retcode[0], output, output_printed
...@@ -280,7 +283,10 @@ def spawn_subprocess(arg, options, base_params): ...@@ -280,7 +283,10 @@ def spawn_subprocess(arg, options, base_params):
if len(output) > OUTPUT_LIMIT: if len(output) > OUTPUT_LIMIT:
output = output[:OUTPUT_LIMIT] + '<AbridgedOutputWarning>' output = output[:OUTPUT_LIMIT] + '<AbridgedOutputWarning>'
if retcode: if retcode:
if not output_printed and options.verbosity >= 0: if retcode == 1 and 'test_support.TestSkipped' in output:
pass
else:
if not output_printed and options.verbosity >= -1:
sys.stdout.write(output) sys.stdout.write(output)
print '%s failed with code %s' % (arg, retcode) print '%s failed with code %s' % (arg, retcode)
elif retcode == 0: elif retcode == 0:
...@@ -402,11 +408,14 @@ def get_ignored_tracebacks(test): ...@@ -402,11 +408,14 @@ def get_ignored_tracebacks(test):
def get_traceback_stats(output, test): def get_traceback_stats(output, test):
ignored = get_ignored_tracebacks(test) or ['ExpectedException'] ignored = get_ignored_tracebacks(test) or ignore_tracebacks
counter = {} counter = {}
traceback_count = output.lower().count('Traceback (most recent call last)') traceback_count = output.lower().count('Traceback (most recent call last)')
ignored_list = []
for error in get_exceptions(output): for error in get_exceptions(output):
if error not in ignored: if error in ignored:
ignored_list.append(error)
else:
counter.setdefault(error, 0) counter.setdefault(error, 0)
counter[error] += 1 counter[error] += 1
traceback_count -= 1 traceback_count -= 1
...@@ -420,13 +429,16 @@ def get_traceback_stats(output, test): ...@@ -420,13 +429,16 @@ def get_traceback_stats(output, test):
result.append('1 %s' % name) result.append('1 %s' % name)
else: else:
result.append('%s %ss' % (count, name)) result.append('%s %ss' % (count, name))
return result return result, ignored_list
def get_info(output, test): def get_info(output, test):
output = output[:OUTPUT_LIMIT*2] output = output[:OUTPUT_LIMIT*2]
result = get_traceback_stats(output, test) + get_warning_stats(output) traceback_stats, ignored_list = get_traceback_stats(output, test)
return ', '.join(result) warning_stats = get_warning_stats(output)
result = traceback_stats + warning_stats
skipped = not warning_stats and not traceback_stats and ignored_list in [['test_support.TestSkipped'], ['test.test_support.TestSkipped']]
return ', '.join(result), skipped
def print_stats(options): def print_stats(options):
...@@ -439,7 +451,7 @@ def print_stats(options): ...@@ -439,7 +451,7 @@ def print_stats(options):
failed, errors = get_failed_testcases(cursor, options.runid) failed, errors = get_failed_testcases(cursor, options.runid)
timedout = get_testcases(cursor, options.runid, 'TIMEOUT') timedout = get_testcases(cursor, options.runid, 'TIMEOUT')
for test, output, retcode in cursor.execute('select test, output, retcode from test where runid=?', (options.runid, )): for test, output, retcode in cursor.execute('select test, output, retcode from test where runid=?', (options.runid, )):
info = get_info(output or '', test) info, skipped = get_info(output or '', test)
if info: if info:
print '%s: %s' % (test, info) print '%s: %s' % (test, info)
if retcode == 'TIMEOUT': if retcode == 'TIMEOUT':
...@@ -454,6 +466,7 @@ def print_stats(options): ...@@ -454,6 +466,7 @@ def print_stats(options):
if testcase.startswith(test + '.'): if testcase.startswith(test + '.'):
break break
else: else:
if not skipped:
failed.append(test) failed.append(test)
total += 1 total += 1
if failed: if failed:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment