1616import pytest
1717import ddt
1818from celery .states import FAILURE , SUCCESS
19+ from django .conf import settings
1920from django .contrib .auth .models import User # lint-amnesty, pylint: disable=imported-auth-user
2021from django .test .utils import override_settings
2122from django .urls import reverse
4647from xmodule .modulestore .tests .factories import BlockFactory # lint-amnesty, pylint: disable=wrong-import-order
4748from common .test .utils import assert_dict_contains_subset
4849
50+ CAPA = "xblocks_contrib.problem" if settings .USE_EXTRACTED_PROBLEM_BLOCK else "xmodule"
51+
4952log = logging .getLogger (__name__ )
5053
5154
@@ -276,7 +279,7 @@ def test_rescoring_failure(self):
276279 self .submit_student_answer ('u1' , problem_url_name , [OPTION_1 , OPTION_1 ])
277280
278281 expected_message = "bad things happened"
279- with patch ('xmodule .capa.capa_problem.LoncapaProblem.get_grade_from_current_answers' ) as mock_rescore :
282+ with patch (f' { CAPA } .capa.capa_problem.LoncapaProblem.get_grade_from_current_answers' ) as mock_rescore :
280283 mock_rescore .side_effect = ZeroDivisionError (expected_message )
281284 instructor_task = self .submit_rescore_all_student_answers ('instructor' , problem_url_name )
282285 self ._assert_task_failure (
@@ -296,7 +299,7 @@ def test_rescoring_bad_unicode_input(self):
296299
297300 # return an input error as if it were a numerical response, with an embedded unicode character:
298301 expected_message = "Could not interpret '2/3\u03a9 ' as a number"
299- with patch ('xmodule .capa.capa_problem.LoncapaProblem.get_grade_from_current_answers' ) as mock_rescore :
302+ with patch (f' { CAPA } .capa.capa_problem.LoncapaProblem.get_grade_from_current_answers' ) as mock_rescore :
300303 mock_rescore .side_effect = StudentInputError (expected_message )
301304 instructor_task = self .submit_rescore_all_student_answers ('instructor' , problem_url_name )
302305
0 commit comments