py_unit_adapter now also counts errors, not just failures

This commit is contained in:
Ralf Teusner
2016-06-10 11:54:11 +02:00
parent 137a8a6c56
commit 1e4ab7cabe

View File

@ -1,6 +1,6 @@
class PyUnitAdapter < TestingFrameworkAdapter
COUNT_REGEXP = /Ran (\d+) test/
FAILURES_REGEXP = /FAILED \(failures=(\d+)\)/
FAILURES_REGEXP = /FAILED \((failures)|(errors)=(\d+)\)/
ASSERTION_ERROR_REGEXP = /AssertionError:\s(.*)/
def self.framework_name
@ -10,7 +10,7 @@ class PyUnitAdapter < TestingFrameworkAdapter
def parse_output(output)
count = COUNT_REGEXP.match(output[:stderr]).captures.first.to_i
matches = FAILURES_REGEXP.match(output[:stderr])
failed = matches ? matches.captures.try(:first).to_i : 0
failed = matches ? matches.captures.try(:third).to_i : 0
error_matches = ASSERTION_ERROR_REGEXP.match(output[:stderr]).try(:captures) || []
{count: count, failed: failed, error_messages: error_matches}
end