Allow negative scores for PyLintAdapter and improve regex handling
This commit is contained in:
@ -1,5 +1,5 @@
|
|||||||
class PyLintAdapter < TestingFrameworkAdapter
|
class PyLintAdapter < TestingFrameworkAdapter
|
||||||
REGEXP = /Your code has been rated at (\d+\.?\d*)\/(\d+\.?\d*)/
|
REGEXP = /Your code has been rated at (-?\d+\.?\d*)\/(\d+\.?\d*)/
|
||||||
ASSERTION_ERROR_REGEXP = /^.*?\(.*?,\ (.*?),.*?\)\ (.*?)$/m
|
ASSERTION_ERROR_REGEXP = /^.*?\(.*?,\ (.*?),.*?\)\ (.*?)$/m
|
||||||
|
|
||||||
def self.framework_name
|
def self.framework_name
|
||||||
@ -7,10 +7,17 @@ class PyLintAdapter < TestingFrameworkAdapter
|
|||||||
end
|
end
|
||||||
|
|
||||||
def parse_output(output)
|
def parse_output(output)
|
||||||
captures = REGEXP.match(output[:stdout]).captures.map(&:to_f)
|
regex_match = REGEXP.match(output[:stdout])
|
||||||
count = captures.second
|
if regex_match.blank?
|
||||||
passed = captures.first
|
count = 0
|
||||||
failed = count - passed
|
failed = 0
|
||||||
|
else
|
||||||
|
captures = regex_match.captures.map(&:to_f)
|
||||||
|
count = captures.second
|
||||||
|
passed = captures.first
|
||||||
|
failed = count - passed
|
||||||
|
end
|
||||||
|
|
||||||
begin
|
begin
|
||||||
assertion_error_matches = Timeout.timeout(2.seconds) do
|
assertion_error_matches = Timeout.timeout(2.seconds) do
|
||||||
output[:stdout].scan(ASSERTION_ERROR_REGEXP).map { |match|
|
output[:stdout].scan(ASSERTION_ERROR_REGEXP).map { |match|
|
||||||
|
Reference in New Issue
Block a user