'Ensures that tasks will be retried if IntegrityErrors are encountered.'

@patch('lms.djangoapps.grades.tasks.recalculate_subsection_grade_v3.retry')
@patch('lms.djangoapps.grades.new.subsection_grade_factory.SubsectionGradeFactory.update')
def test_retry_on_integrity_error(self, mock_update, mock_retry):

    self.set_up_course()
    mock_update.side_effect = IntegrityError('WHAMMY')
    self._apply_recalculate_subsection_grade()
    self._assert_retry_called(mock_retry)
