Skip to content

Commit 1719d2c

Browse files
committed
fix: add problem block
1 parent 50da280 commit 1719d2c

File tree

9 files changed

+143
-79
lines changed

9 files changed

+143
-79
lines changed

.github/workflows/unit-tests.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ jobs:
2020
name: ${{ matrix.shard_name }}(py=${{ matrix.python-version }},dj=${{ matrix.django-version }},mongo=${{ matrix.mongo-version }})
2121
runs-on: ${{ matrix.os-version }}
2222
strategy:
23+
fail-fast: false
2324
matrix:
2425
python-version:
2526
- "3.11"

lms/djangoapps/courseware/tests/test_submitting_problems.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,11 @@
4343
from xmodule.modulestore.tests.factories import CourseFactory, BlockFactory # lint-amnesty, pylint: disable=wrong-import-order
4444
from xmodule.partitions.partitions import Group, UserPartition # lint-amnesty, pylint: disable=wrong-import-order
4545

46+
if settings.USE_EXTRACTED_PROBLEM_BLOCK:
47+
from xblocks_contrib.problem.capa.xqueue_interface import XQueueInterface
48+
else:
49+
from xmodule.capa.xqueue_interface import XQueueInterface
50+
4651

4752
class ProblemSubmissionTestMixin(TestCase):
4853
"""

lms/djangoapps/instructor_task/tests/test_integration.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
import pytest
1717
import ddt
1818
from celery.states import FAILURE, SUCCESS
19+
from django.conf import settings
1920
from django.contrib.auth.models import User # lint-amnesty, pylint: disable=imported-auth-user
2021
from django.test.utils import override_settings
2122
from django.urls import reverse
@@ -46,6 +47,8 @@
4647
from xmodule.modulestore.tests.factories import BlockFactory # lint-amnesty, pylint: disable=wrong-import-order
4748
from common.test.utils import assert_dict_contains_subset
4849

50+
CAPA = "xblocks_contrib.problem" if settings.USE_EXTRACTED_PROBLEM_BLOCK else "xmodule"
51+
4952
log = 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

openedx/envs/common.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2095,7 +2095,7 @@ def add_optional_apps(optional_apps, installed_apps):
20952095
# .. toggle_warning: Not production-ready until relevant subtask https://github.com/openedx/edx-platform/issues/34827 is done.
20962096
# .. toggle_creation_date: 2024-11-10
20972097
# .. toggle_target_removal_date: 2025-06-01
2098-
USE_EXTRACTED_PROBLEM_BLOCK = False
2098+
USE_EXTRACTED_PROBLEM_BLOCK = True
20992099

21002100
# .. toggle_name: USE_EXTRACTED_VIDEO_BLOCK
21012101
# .. toggle_default: False

requirements/edx/base.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1267,7 +1267,7 @@ xblock-utils==4.0.0
12671267
# via
12681268
# edx-sga
12691269
# xblock-poll
1270-
xblocks-contrib==0.10.2
1270+
git+https://github.com/openedx/xblocks-contrib.git@fix-problemblock
12711271
# via -r requirements/edx/bundled.in
12721272
xmlsec==1.3.14
12731273
# via

requirements/edx/development.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2299,7 +2299,7 @@ xblock-utils==4.0.0
22992299
# -r requirements/edx/testing.txt
23002300
# edx-sga
23012301
# xblock-poll
2302-
xblocks-contrib==0.10.2
2302+
git+https://github.com/openedx/xblocks-contrib.git@fix-problemblock
23032303
# via
23042304
# -r requirements/edx/doc.txt
23052305
# -r requirements/edx/testing.txt

requirements/edx/doc.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1609,7 +1609,7 @@ xblock-utils==4.0.0
16091609
# -r requirements/edx/base.txt
16101610
# edx-sga
16111611
# xblock-poll
1612-
xblocks-contrib==0.10.2
1612+
git+https://github.com/openedx/xblocks-contrib.git@fix-problemblock
16131613
# via -r requirements/edx/base.txt
16141614
xmlsec==1.3.14
16151615
# via

requirements/edx/testing.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1699,7 +1699,7 @@ xblock-utils==4.0.0
16991699
# -r requirements/edx/base.txt
17001700
# edx-sga
17011701
# xblock-poll
1702-
xblocks-contrib==0.10.2
1702+
git+https://github.com/openedx/xblocks-contrib.git@fix-problemblock
17031703
# via -r requirements/edx/base.txt
17041704
xmlsec==1.3.14
17051705
# via

0 commit comments

Comments
 (0)