changeset 249:dcba83c01266

If `<python:unittest>` sees test failures, it logs an appropriate error containing the number of failures versus the total number of tests.
author cmlenz
date Tue, 04 Oct 2005 11:23:48 +0000
parents 15d8d8c809f0
children 0271a2b1fc23
files bitten/build/pythontools.py
diffstat 1 files changed, 7 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/bitten/build/pythontools.py
+++ b/bitten/build/pythontools.py
@@ -229,6 +229,7 @@
     try:
         fd = open(ctxt.resolve(file_), 'r')
         try:
+            total, failed = 0, 0
             results = xmlio.Fragment()
             for child in xmlio.parse(fd).children():
                 test = xmlio.Element('test')
@@ -241,11 +242,17 @@
                         else:
                             continue
                     test.attr[name] = value
+                    if name == 'status' and value in ('error', 'failure'):
+                        failed += 1
                 for grandchild in child.children():
                     test.append(xmlio.Element(grandchild.name)[
                         grandchild.gettext()
                     ])
                 results.append(test)
+                total += 1
+            if failed:
+                ctxt.error('%d of %d test%s failed' % (failed, total,
+                           total != 1 and 's' or ''))
             ctxt.report('test', results)
         finally:
             fd.close()
Copyright (C) 2012-2017 Edgewall Software