1919from django .contrib .auth .models import User # lint-amnesty, pylint: disable=imported-auth-user
2020from django .test .utils import override_settings
2121from django .urls import reverse
22+ from django .conf import settings
2223
2324from xmodule .capa .responsetypes import StudentInputError
2425from xmodule .capa .tests .response_xml_factory import CodeResponseXMLFactory , CustomResponseXMLFactory
4546from xmodule .modulestore import ModuleStoreEnum # lint-amnesty, pylint: disable=wrong-import-order
4647from xmodule .modulestore .tests .factories import BlockFactory # lint-amnesty, pylint: disable=wrong-import-order
4748
49+ PREFIX_CAPA = "xblocks_contrib.problem" if settings .USE_EXTRACTED_PROBLEM_BLOCK else "xmodule"
50+
4851log = logging .getLogger (__name__ )
4952
5053
@@ -275,7 +278,7 @@ def test_rescoring_failure(self):
275278 self .submit_student_answer ('u1' , problem_url_name , [OPTION_1 , OPTION_1 ])
276279
277280 expected_message = "bad things happened"
278- with patch ('xmodule .capa.capa_problem.LoncapaProblem.get_grade_from_current_answers' ) as mock_rescore :
281+ with patch (f' { PREFIX_CAPA } .capa.capa_problem.LoncapaProblem.get_grade_from_current_answers' ) as mock_rescore :
279282 mock_rescore .side_effect = ZeroDivisionError (expected_message )
280283 instructor_task = self .submit_rescore_all_student_answers ('instructor' , problem_url_name )
281284 self ._assert_task_failure (
@@ -295,7 +298,7 @@ def test_rescoring_bad_unicode_input(self):
295298
296299 # return an input error as if it were a numerical response, with an embedded unicode character:
297300 expected_message = "Could not interpret '2/3\u03a9 ' as a number"
298- with patch ('xmodule .capa.capa_problem.LoncapaProblem.get_grade_from_current_answers' ) as mock_rescore :
301+ with patch (f' { PREFIX_CAPA } .capa.capa_problem.LoncapaProblem.get_grade_from_current_answers' ) as mock_rescore :
299302 mock_rescore .side_effect = StudentInputError (expected_message )
300303 instructor_task = self .submit_rescore_all_student_answers ('instructor' , problem_url_name )
301304
0 commit comments