tests: Properly label and detect unexpected successes
Unexpected successes were being labeled as failures, which might be related to [1]. This behaviour is indeed welcome - we want to detect if tests are unexpectedly succeeding via test pipeline failures, however, the current implementation of the simpletap did not properly implement this. [1] https://bugs.python.org/issue20165
This commit is contained in:
@@ -56,7 +56,7 @@ if __name__ == "__main__":
|
||||
timestamp = re.compile("^# (\d+(?:\.\d+)?) ==>.*$")
|
||||
|
||||
expected_fail = re.compile(r"^not ok.*?#\s*TODO", re.I)
|
||||
unexpected_pass = re.compile(r"^ok .*?#\s*TODO", re.I)
|
||||
unexpected_pass = re.compile(r"^not ok .*?#\s*FIXED", re.I)
|
||||
skip = re.compile(r"^ok .*?#\s*skip", re.I)
|
||||
ok = re.compile(r"^ok ", re.I)
|
||||
not_ok = re.compile(r"^not ok", re.I)
|
||||
|
||||
@@ -162,6 +162,10 @@ class TAPTestResult(unittest.result.TestResult):
|
||||
self.stream.writeln("{0} {1} - {2}: {3} # TODO".format(
|
||||
color("not ok", "yellow"), self.testsRun, filename, desc)
|
||||
)
|
||||
elif status == "UNEXPECTED_SUCCESS":
|
||||
self.stream.writeln("{0} {1} - {2}: {3} # FIXED".format(
|
||||
color("not ok", "yellow"), self.testsRun, filename, desc)
|
||||
)
|
||||
else:
|
||||
self.stream.writeln("{0} {1} - {2}: {3}".format(
|
||||
color("not ok", "red"), self.testsRun, filename, desc)
|
||||
|
||||
Reference in New Issue
Block a user