Add python adapter error messages to score output
This commit is contained in:
@ -703,7 +703,8 @@ $(function() {
|
|||||||
panel.find('.row .col-sm-9').eq(1).find('.number').eq(0).text((result.score * result.weight).toFixed(2));
|
panel.find('.row .col-sm-9').eq(1).find('.number').eq(0).text((result.score * result.weight).toFixed(2));
|
||||||
panel.find('.row .col-sm-9').eq(1).find('.number').eq(1).text(result.weight);
|
panel.find('.row .col-sm-9').eq(1).find('.number').eq(1).text(result.weight);
|
||||||
panel.find('.row .col-sm-9').eq(2).text(result.message);
|
panel.find('.row .col-sm-9').eq(2).text(result.message);
|
||||||
panel.find('.row .col-sm-9').eq(3).find('a').attr('href', '#output-' + index);
|
panel.find('.row .col-sm-9').eq(3).text(result.error_messages.join(', '));
|
||||||
|
panel.find('.row .col-sm-9').eq(4).find('a').attr('href', '#output-' + index);
|
||||||
};
|
};
|
||||||
|
|
||||||
var chunkBuffer = [{streamedResponse: true}];
|
var chunkBuffer = [{streamedResponse: true}];
|
||||||
|
@ -66,6 +66,7 @@
|
|||||||
= row(label: '.passed_tests', value: t('shared.out_of', maximum_value: 0, value: 0).html_safe)
|
= row(label: '.passed_tests', value: t('shared.out_of', maximum_value: 0, value: 0).html_safe)
|
||||||
= row(label: 'activerecord.attributes.submission.score', value: t('shared.out_of', maximum_value: 0, value: 0).html_safe)
|
= row(label: 'activerecord.attributes.submission.score', value: t('shared.out_of', maximum_value: 0, value: 0).html_safe)
|
||||||
= row(label: '.feedback')
|
= row(label: '.feedback')
|
||||||
|
= row(label: '.error_messages')
|
||||||
= row(label: '.output', value: link_to(t('shared.show'), '#'))
|
= row(label: '.output', value: link_to(t('shared.show'), '#'))
|
||||||
#score data-maximum-score=@exercise.maximum_score data-score=@submission.try(:score)
|
#score data-maximum-score=@exercise.maximum_score data-score=@submission.try(:score)
|
||||||
h4
|
h4
|
||||||
|
@ -222,6 +222,7 @@ de:
|
|||||||
text: 'Ihr Browser unterstützt nicht alle Funktionalitäten, die %{application_name} benötigt. Bitte nutzen Sie einen modernen Browser, um %{application_name} zu besuchen.'
|
text: 'Ihr Browser unterstützt nicht alle Funktionalitäten, die %{application_name} benötigt. Bitte nutzen Sie einen modernen Browser, um %{application_name} zu besuchen.'
|
||||||
title: Ihr Browser wird nicht unterstützt!
|
title: Ihr Browser wird nicht unterstützt!
|
||||||
default_feedback: Sehr gut. Alle Tests waren erfolgreich.
|
default_feedback: Sehr gut. Alle Tests waren erfolgreich.
|
||||||
|
error_messages: Fehlermeldungen
|
||||||
feedback: Feedback
|
feedback: Feedback
|
||||||
file: 'Test-Datei <span class="number">%{number}</span> (<span class="filename">%{filename}</span>)'
|
file: 'Test-Datei <span class="number">%{number}</span> (<span class="filename">%{filename}</span>)'
|
||||||
hint: Tipp
|
hint: Tipp
|
||||||
|
@ -222,6 +222,7 @@ en:
|
|||||||
text: 'Your browser does not support features required for using %{application_name}. Please access %{application_name} using a modern browser.'
|
text: 'Your browser does not support features required for using %{application_name}. Please access %{application_name} using a modern browser.'
|
||||||
title: Your browser is not supported!
|
title: Your browser is not supported!
|
||||||
default_feedback: Well done. All tests have been passed.
|
default_feedback: Well done. All tests have been passed.
|
||||||
|
error_messages: Error Messages
|
||||||
feedback: Feedback
|
feedback: Feedback
|
||||||
file: 'Test File <span class="number">%{number}</span> (<span class="filename">%{filename}</span>)'
|
file: 'Test File <span class="number">%{number}</span> (<span class="filename">%{filename}</span>)'
|
||||||
hint: Hint
|
hint: Hint
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
class PyUnitAdapter < TestingFrameworkAdapter
|
class PyUnitAdapter < TestingFrameworkAdapter
|
||||||
COUNT_REGEXP = /Ran (\d+) test/
|
COUNT_REGEXP = /Ran (\d+) test/
|
||||||
FAILURES_REGEXP = /FAILED \(failures=(\d+)\)/
|
FAILURES_REGEXP = /FAILED \(failures=(\d+)\)/
|
||||||
|
ASSERTION_ERROR_REGEXP = /AssertionError:\s(.*)/
|
||||||
|
|
||||||
def self.framework_name
|
def self.framework_name
|
||||||
'PyUnit'
|
'PyUnit'
|
||||||
@ -10,6 +11,7 @@ class PyUnitAdapter < TestingFrameworkAdapter
|
|||||||
count = COUNT_REGEXP.match(output[:stderr]).captures.first.to_i
|
count = COUNT_REGEXP.match(output[:stderr]).captures.first.to_i
|
||||||
matches = FAILURES_REGEXP.match(output[:stderr])
|
matches = FAILURES_REGEXP.match(output[:stderr])
|
||||||
failed = matches ? matches.captures.try(:first).to_i : 0
|
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
|
||||||
end
|
end
|
||||||
|
Reference in New Issue
Block a user