'Ensures that a task retry completes after a one-time failure.'

@patch('lms.djangoapps.grades.signals.signals.SUBSECTION_SCORE_CHANGED.send')
@patch('lms.djangoapps.grades.new.subsection_grade_factory.SubsectionGradeFactory.update')
def test_retry_first_time_only(self, mock_update, mock_course_signal):

    self.set_up_course()
    mock_update.side_effect = [IntegrityError('WHAMMY'), None]
    self._apply_recalculate_subsection_grade()
    self.assertEquals(mock_course_signal.call_count, 1)
