From 9e644563e3eae71b48b990323c3d9fd545628cf9 Mon Sep 17 00:00:00 2001 From: Ralf Teusner Date: Thu, 16 Jun 2016 11:39:13 +0200 Subject: [PATCH] adapt regex for py_unit_adapter once more... hopefully we got all cases now. --- lib/py_unit_adapter.rb | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/lib/py_unit_adapter.rb b/lib/py_unit_adapter.rb index 11b8cb09..1ff5cd98 100644 --- a/lib/py_unit_adapter.rb +++ b/lib/py_unit_adapter.rb @@ -1,6 +1,7 @@ class PyUnitAdapter < TestingFrameworkAdapter COUNT_REGEXP = /Ran (\d+) test/ - FAILURES_REGEXP = /FAILED \((failures|errors)=(\d+)\)/ + FAILURES_REGEXP = /FAILED \(.*failures=(\d+).*\)/ + ERRORS_REGEXP = /FAILED \(.*errors=(\d+).*\)/ ASSERTION_ERROR_REGEXP = /AssertionError:\s(.*)/ def self.framework_name @@ -9,9 +10,11 @@ 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(:second).to_i : 0 - error_matches = ASSERTION_ERROR_REGEXP.match(output[:stderr]).try(:captures) || [] - {count: count, failed: failed, error_messages: error_matches} + failures_matches = FAILURES_REGEXP.match(output[:stderr]) + failed = failures_matches ? failures_matches.captures.try(:first).to_i : 0 + error_matches = ERRORS_REGEXP.match(output[:stderr]) + errors = error_matches ? error_matches.captures.try(:first).to_i : 0 + assertion_error_matches = ASSERTION_ERROR_REGEXP.match(output[:stderr]).try(:captures) || [] + {count: count, failed: failed + errors, error_messages: assertion_error_matches} end end