l = fh.readline()
if l == "":
break
- if l.startswith("test: "):
+ if l.startswith("test: ") or l.startswith("testing: "):
msg_ops.control_msg(l)
name = l.split(":", 1)[1].strip()
msg_ops.start_test(name)
else:
reason = None
if result in ("success", "successful"):
- open_tests.pop() #FIXME: Check that popped value == $testname
- statistics['TESTS_EXPECTED_OK']+=1
- msg_ops.end_test(testname, "success", False, reason)
+ try:
+ open_tests.remove(testname)
+ except KeyError:
+ statistics['TESTS_ERROR']+=1
+ msg_ops.end_test(testname, "error", True,
+ "Test was never started")
+ else:
+ statistics['TESTS_EXPECTED_OK']+=1
+ msg_ops.end_test(testname, "success", False, reason)
elif result in ("xfail", "knownfail"):
- open_tests.pop() #FIXME: Check that popped value == $testname
- statistics['TESTS_EXPECTED_FAIL']+=1
- msg_ops.end_test(testname, "xfail", False, reason)
- expected_fail+=1
+ try:
+ open_tests.remove(testname)
+ except KeyError:
+ statistics['TESTS_ERROR']+=1
+ msg_ops.end_test(testname, "error", True,
+ "Test was never started")
+ else:
+ statistics['TESTS_EXPECTED_FAIL']+=1
+ msg_ops.end_test(testname, "xfail", False, reason)
+ expected_fail+=1
elif result in ("failure", "fail"):
- open_tests.pop() #FIXME: Check that popped value == $testname
- statistics['TESTS_UNEXPECTED_FAIL']+=1
- msg_ops.end_test(testname, "failure", True, reason)
+ try:
+ open_tests.remove(testname)
+ except KeyError:
+ statistics['TESTS_ERROR']+=1
+ msg_ops.end_test(testname, "error", True,
+ "Test was never started")
+ else:
+ statistics['TESTS_UNEXPECTED_FAIL']+=1
+ msg_ops.end_test(testname, "failure", True, reason)
elif result == "skip":
statistics['TESTS_SKIP']+=1
# Allow tests to be skipped without prior announcement of test
msg_ops.end_test(testname, "skip", False, reason)
elif result == "error":
statistics['TESTS_ERROR']+=1
- open_tests.pop() #FIXME: Check that popped value == $testname
+ try:
+ open_tests.remove(testname)
+ except KeyError:
+ pass
msg_ops.end_test(testname, "error", True, reason)
elif result == "skip-testsuite":
msg_ops.skip_testsuite(testname)
def read_test_regexes(name):
+ ret = {}
f = open(name, 'r')
try:
for l in f:
continue
if "#" in l:
(regex, reason) = l.split("#", 1)
- yield (regex.strip(), reason.strip())
+ ret[regex.strip()] = reason.strip()
else:
- yield l, None
+ ret[l] = None
finally:
f.close()
+ return ret
def find_in_list(regexes, fullname):
- for regex, reason in regexes:
+ for regex, reason in regexes.iteritems():
if re.match(regex, fullname):
if reason is None:
return ""