[PATCH] subunithelper: return non zero if a testsuite fails before any test has runned
Matthieu Patou
mat at matws.net
Sat Nov 20 03:13:04 MST 2010
---
selftest/subunithelper.py | 9 ++++++++-
1 files changed, 8 insertions(+), 1 deletions(-)
diff --git a/selftest/subunithelper.py b/selftest/subunithelper.py
index 5d2d665..f869bae 100644
--- a/selftest/subunithelper.py
+++ b/selftest/subunithelper.py
@@ -34,6 +34,7 @@ class TestsuiteEnabledTestResult(testtools.testresult.TestResult):
def parse_results(msg_ops, statistics, fh):
expected_fail = 0
open_tests = {}
+ runned_test = 0
while fh:
l = fh.readline()
@@ -53,6 +54,7 @@ def parse_results(msg_ops, statistics, fh):
msg_ops.addError(open_tests.pop(name), subunit.RemoteError(u"Test already running"))
msg_ops.startTest(test)
open_tests[name] = test
+ runned_test += 1
elif command == "time":
msg_ops.control_msg(l)
try:
@@ -138,7 +140,11 @@ def parse_results(msg_ops, statistics, fh):
elif result == "testsuite-success":
msg_ops.end_testsuite(testname, "success", reason)
elif result == "testsuite-failure":
- msg_ops.end_testsuite(testname, "failure", reason)
+ if runned_test == 0:
+ statistics['TESTS_ERROR']+=1
+ msg_ops.end_testsuite(testname, "error", reason)
+ else:
+ msg_ops.end_testsuite(testname, "failure", reason)
elif result == "testsuite-xfail":
msg_ops.end_testsuite(testname, "xfail", reason)
elif result == "testsuite-error":
@@ -147,6 +153,7 @@ def parse_results(msg_ops, statistics, fh):
raise AssertionError("Recognized but unhandled result %r" %
result)
elif command == "testsuite":
+ runned_test = 0
msg_ops.start_testsuite(arg.strip())
elif command == "progress":
arg = arg.strip()
--
1.7.1
--------------060109070108070506000807--
More information about the samba-technical
mailing list