@contextmanager
def mock_passing_grade(grade_pass='Pass', percent=0.75):
 with patch('lms.djangoapps.grades.new.course_grade.CourseGrade._compute_letter_grade') as mock_letter_grade:
  with patch('lms.djangoapps.grades.new.course_grade.CourseGrade._calc_percent') as mock_percent_grade:
   mock_letter_grade.return_value = grade_pass
   mock_percent_grade.return_value = percent
   (yield)

@ contextmanager def mock_passing_grade ( grade_pass = 'Pass' , percent = 0.75 ) : with patch ( 'lms.djangoapps.grades.new.course_grade.CourseGrade._compute_letter_grade' ) as mock_letter_grade : with patch ( 'lms.djangoapps.grades.new.course_grade.CourseGrade._calc_percent' ) as mock_percent_grade : mock_letter_grade . return_value = grade_pass mock_percent_grade . return_value = percent ( yield )
mock the grading function to always return a passing grade .