Add python adapter error messages to score output

This commit is contained in:
Maximilian Grundke
2016-03-09 18:01:30 +01:00
parent 26d2b11d9f
commit 99ee7337ed
5 changed files with 8 additions and 2 deletions

View File

@ -1,6 +1,7 @@
class PyUnitAdapter < TestingFrameworkAdapter
COUNT_REGEXP = /Ran (\d+) test/
FAILURES_REGEXP = /FAILED \(failures=(\d+)\)/
ASSERTION_ERROR_REGEXP = /AssertionError:\s(.*)/
def self.framework_name
'PyUnit'
@ -10,6 +11,7 @@ class PyUnitAdapter < TestingFrameworkAdapter
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
{count: count, failed: failed}
error_matches = ASSERTION_ERROR_REGEXP.match(output[:stderr]).captures
{count: count, failed: failed, error_messages: error_matches}
end
end