Skip to content

Commit 9267fb4

Browse files
committed
fix: add problem block
1 parent 50da280 commit 9267fb4

File tree

6 files changed

+49
-9
lines changed

6 files changed

+49
-9
lines changed

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

xmodule/tests/test_capa_block.py

Lines changed: 44 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ class CapaFactoryWithFiles(CapaFactory):
203203

204204
@ddt.ddt
205205
@skip_unless_lms
206-
class ProblemBlockTest(unittest.TestCase): # pylint: disable=too-many-public-methods
206+
class _ProblemBlockTestBase(unittest.TestCase): # pylint: disable=too-many-public-methods
207207
"""Tests for various problem types in XBlocks."""
208208

209209
def setUp(self):
@@ -2843,8 +2843,18 @@ def test_problem_no_display_name(self, display_name, render_template):
28432843
assert context["problem"]["name"] == block.location.block_type
28442844

28452845

2846+
@override_settings(USE_EXTRACTED_PROBLEM_BLOCK=True)
2847+
class ExtractedProblemBlockTestCase(_ProblemBlockTestBase):
2848+
__test__ = True
2849+
2850+
2851+
@override_settings(USE_EXTRACTED_PROBLEM_BLOCK=False)
2852+
class BuiltInProblemBlockTestCase(_ProblemBlockTestBase):
2853+
__test__ = True
2854+
2855+
28462856
@ddt.ddt
2847-
class ProblemBlockXMLTest(unittest.TestCase):
2857+
class _ProblemBlockXMLTestBase(unittest.TestCase):
28482858
"""Tests XML strings for various problem types in XBlocks."""
28492859

28502860
sample_checkbox_problem_xml = textwrap.dedent(
@@ -3693,6 +3703,16 @@ def test_invalid_dropdown_xml(self):
36933703
CapaFactory.create(xml=problem_xml)
36943704

36953705

3706+
@override_settings(USE_EXTRACTED_PROBLEM_BLOCK=True)
3707+
class ExtractedProblemBlockXMLTestCase(_ProblemBlockXMLTestBase):
3708+
__test__ = True
3709+
3710+
3711+
@override_settings(USE_EXTRACTED_PROBLEM_BLOCK=False)
3712+
class BuiltInProblemBlockXMLTestCase(_ProblemBlockXMLTestBase):
3713+
__test__ = True
3714+
3715+
36963716
class ComplexEncoderTest(unittest.TestCase):
36973717
"""Tests JSON encoding of complex numbers."""
36983718

@@ -3709,7 +3729,7 @@ def test_default(self):
37093729

37103730
@skip_unless_lms
37113731
@UseUnsafeCodejail()
3712-
class ProblemCheckTrackingTest(unittest.TestCase):
3732+
class _ProblemCheckTrackingTestBase(unittest.TestCase):
37133733
"""
37143734
Ensure correct tracking information is included in events emitted during problem checks.
37153735
"""
@@ -4045,7 +4065,17 @@ def test_get_answer_with_jump_to_id_urls(self):
40454065
assert problem.runtime.service(problem, "replace_urls").replace_urls.called
40464066

40474067

4048-
class ProblemBlockReportGenerationTest(unittest.TestCase):
4068+
@override_settings(USE_EXTRACTED_PROBLEM_BLOCK=True)
4069+
class ExtractedProblemCheckTrackingTestCase(_ProblemCheckTrackingTestBase):
4070+
__test__ = True
4071+
4072+
4073+
@override_settings(USE_EXTRACTED_PROBLEM_BLOCK=False)
4074+
class BuiltInProblemCheckTrackingTestCase(_ProblemCheckTrackingTestBase):
4075+
__test__ = True
4076+
4077+
4078+
class _ProblemBlockReportGenerationTestBase(unittest.TestCase):
40494079
"""
40504080
Ensure that Capa report generation works correctly
40514081
"""
@@ -4140,3 +4170,13 @@ def test_generate_report_data_report_loncapa_error(self):
41404170
)
41414171
)
41424172
assert "Python Error: No Answer Retrieved" in list(report_data[0][1].values())
4173+
4174+
4175+
@override_settings(USE_EXTRACTED_PROBLEM_BLOCK=True)
4176+
class ExtractedProblemBlockReportGenerationTestCase(_ProblemBlockReportGenerationTestBase):
4177+
__test__ = True
4178+
4179+
4180+
@override_settings(USE_EXTRACTED_PROBLEM_BLOCK=False)
4181+
class BuiltInProblemBlockReportGenerationTestCase(_ProblemBlockReportGenerationTestBase):
4182+
__test__ = True

0 commit comments

Comments
 (0)