Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cms/djangoapps/contentstore/tests/test_contentstore.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
from opaque_keys.edx.keys import AssetKey, CourseKey, UsageKey
from opaque_keys.edx.locations import CourseLocator
from path import Path as path
from xblock_problem import ProblemBlock

from cms.djangoapps.contentstore import toggles
from cms.djangoapps.contentstore.config import waffle
Expand All @@ -42,7 +43,6 @@
from common.djangoapps.student.roles import CourseCreatorRole, CourseInstructorRole
from openedx.core.djangoapps.django_comment_common.utils import are_permissions_roles_seeded
from openedx.core.lib.tempdir import mkdtemp_clean
from xmodule.capa_block import ProblemBlock
from xmodule.contentstore.content import StaticContent
from xmodule.contentstore.django import contentstore
from xmodule.contentstore.utils import empty_asset_trashcan, restore_asset_from_trashcan
Expand Down
3 changes: 2 additions & 1 deletion cms/djangoapps/contentstore/tests/test_crud.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
"""Tests for CRUD Operations"""


from xblock_problem import ProblemBlock

from xmodule import templates
from xmodule.capa_block import ProblemBlock
from xmodule.course_block import CourseBlock
from xmodule.modulestore import ModuleStoreEnum
from xmodule.modulestore.exceptions import DuplicateCourseError
Expand Down
2 changes: 1 addition & 1 deletion cms/lib/xblock/tagging/tagging.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
from webob import Response
from xblock.core import XBlock, XBlockAside
from xblock.fields import Dict, Scope
from xblock_problem import ProblemBlock # pylint: disable=wrong-import-order

from common.djangoapps.edxmako.shortcuts import render_to_string
from xmodule.capa_block import ProblemBlock # pylint: disable=wrong-import-order
from xmodule.x_module import AUTHOR_VIEW # pylint: disable=wrong-import-order

_ = lambda text: text
Expand Down
2 changes: 1 addition & 1 deletion lms/djangoapps/courseware/tests/test_block_render.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
Mixologist, # pylint: disable=wrong-import-order
)
from xblock.test.tools import TestRuntime # pylint: disable=wrong-import-order
from xblock_problem import ProblemBlock
from xblock_problem.capa.testing.response_xml_factory import (
OptionResponseXMLFactory, # pylint: disable=reimported
)
Expand Down Expand Up @@ -96,7 +97,6 @@
from openedx.core.lib.courses import course_image_url
from openedx.core.lib.gating import api as gating_api
from openedx.core.lib.url_utils import quote_slashes
from xmodule.capa_block import ProblemBlock
from xmodule.contentstore.django import contentstore
from xmodule.html_block import AboutBlock, CourseInfoBlock, HtmlBlock, StaticTabBlock
from xmodule.lti_block import LTIBlock
Expand Down
25 changes: 0 additions & 25 deletions lms/djangoapps/grades/tests/integration/test_problems.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,13 @@
import ddt
import pytz
from crum import set_current_request
from django.test.utils import override_settings
from xblock_problem.capa.testing.response_xml_factory import MultipleChoiceResponseXMLFactory

from common.djangoapps.student.models import CourseEnrollment
from common.djangoapps.student.tests.factories import UserFactory
from lms.djangoapps.course_blocks.api import get_course_blocks
from lms.djangoapps.courseware.tests.test_submitting_problems import ProblemSubmissionTestMixin
from openedx.core.djangolib.testing.utils import get_mock_request
from xmodule.capa_block import reset_class
from xmodule.graders import ProblemScore
from xmodule.modulestore import ModuleStoreEnum
from xmodule.modulestore.tests.django_utils import (
Expand Down Expand Up @@ -42,14 +40,12 @@ class _TestMultipleProblemTypesSubsectionScoresBase(SharedModuleStoreTestCase):

@classmethod
def setUpClass(cls):
reset_class()
super().setUpClass()
cls.load_scoreable_course()
chapter1 = cls.course.get_children()[0]
cls.seq1 = chapter1.get_children()[0]

def setUp(self):
reset_class()
super().setUp()
self.student = UserFactory.create(is_staff=False, username='test_student', password=self.TEST_PASSWORD)
self.client.login(username=self.student.username, password=self.TEST_PASSWORD)
Expand Down Expand Up @@ -106,16 +102,10 @@ def test_score_submission_for_all_problems(self):
assert score.all_total.possible == (possible_per_block * block_count)


@override_settings(USE_EXTRACTED_PROBLEM_BLOCK=True)
class ExtractedTestMultipleProblemTypesSubsectionScores(_TestMultipleProblemTypesSubsectionScoresBase):
__test__ = True


@override_settings(USE_EXTRACTED_PROBLEM_BLOCK=False)
class BuiltInTestMultipleProblemTypesSubsectionScores(_TestMultipleProblemTypesSubsectionScoresBase):
__test__ = True


@ddt.ddt
class _TestVariedMetadataBase(ProblemSubmissionTestMixin, ModuleStoreTestCase):
"""
Expand All @@ -132,7 +122,6 @@ class _TestVariedMetadataBase(ProblemSubmissionTestMixin, ModuleStoreTestCase):
}

def setUp(self):
reset_class()
super().setUp()
self.course = CourseFactory.create()
with self.store.bulk_operations(self.course.id):
Expand Down Expand Up @@ -229,16 +218,10 @@ def test_graded_metadata_alterations(self, alterations, expected_earned, expecte
assert score.graded_total.possible == expected_possible


@override_settings(USE_EXTRACTED_PROBLEM_BLOCK=True)
class ExtractedTestVariedMetadata(_TestVariedMetadataBase):
__test__ = True


@override_settings(USE_EXTRACTED_PROBLEM_BLOCK=False)
class BuiltInTestVariedMetadata(_TestVariedMetadataBase):
__test__ = True


@ddt.ddt
class _TestWeightedProblemsBase(SharedModuleStoreTestCase):
"""
Expand All @@ -249,7 +232,6 @@ class _TestWeightedProblemsBase(SharedModuleStoreTestCase):

@classmethod
def setUpClass(cls):
reset_class()
super().setUpClass()
cls.course = CourseFactory.create()
with cls.store.bulk_operations(cls.course.id):
Expand All @@ -269,7 +251,6 @@ def setUpClass(cls):
)

def setUp(self):
reset_class()
super().setUp()
self.user = UserFactory()
self.addCleanup(set_current_request, None)
Expand Down Expand Up @@ -350,11 +331,5 @@ def test_problem_weight(self, raw_earned, raw_possible, weight):
self._verify_grades(raw_earned, raw_possible, weight, expected_score)


@override_settings(USE_EXTRACTED_PROBLEM_BLOCK=True)
class ExtractedTestWeightedProblems(_TestWeightedProblemsBase):
__test__ = True


@override_settings(USE_EXTRACTED_PROBLEM_BLOCK=False)
class BuiltInTestWeightedProblems(_TestWeightedProblemsBase):
__test__ = True
8 changes: 4 additions & 4 deletions lms/djangoapps/instructor_task/tests/test_tasks_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -510,7 +510,7 @@ def _remove_capa_report_generator(self):
Temporarily removes the generate_report_data method so we can test
report generation when it's absent.
"""
from xmodule.capa_block import ProblemBlock
from xblock_problem import ProblemBlock
generate_report_data = ProblemBlock.generate_report_data
del ProblemBlock.generate_report_data
try:
Expand Down Expand Up @@ -611,7 +611,7 @@ def test_build_student_data_for_block_without_generate_report_data(self, mock_li
assert student_data_keys_list == ['username', 'title', 'location', 'block_key', 'state']
mock_list_problem_responses.assert_called_with(self.course.id, ANY, ANY)

@patch('xmodule.capa_block.ProblemBlock.generate_report_data', create=True)
@patch('xblock_problem.ProblemBlock.generate_report_data', create=True)
def test_build_student_data_for_block_with_mock_generate_report_data(self, mock_generate_report_data):
"""
Ensure that building student data for a block that supports the
Expand Down Expand Up @@ -658,7 +658,7 @@ def test_build_student_data_for_block_with_mock_generate_report_data(self, mock_
assert student_data[0]['state'] == student_data[1]['state']
assert student_data_keys_list == ['username', 'title', 'location', 'more', 'some', 'block_key', 'state']

@patch('xmodule.capa_block.ProblemBlock.generate_report_data', create=True)
@patch('xblock_problem.ProblemBlock.generate_report_data', create=True)
def test_build_student_data_for_block_with_ordered_generate_report_data(self, mock_generate_report_data):
"""
Ensure that building student data for a block that returns OrderedDicts from the
Expand Down Expand Up @@ -801,7 +801,7 @@ def test_build_student_data_with_filter(self, filters, filtered_count):
assert len(student_data) == filtered_count

@patch('lms.djangoapps.instructor_task.tasks_helper.grades.list_problem_responses')
@patch('xmodule.capa_block.ProblemBlock.generate_report_data', create=True)
@patch('xblock_problem.ProblemBlock.generate_report_data', create=True)
def test_build_student_data_for_block_with_generate_report_data_not_implemented(
self,
mock_generate_report_data,
Expand Down
2 changes: 1 addition & 1 deletion openedx/core/djangoapps/content_libraries/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,10 @@
from user_tasks.models import UserTaskArtifact
from user_tasks.tasks import UserTask, UserTaskStatus
from xblock.fields import Scope
from xblock_problem import ProblemBlock

from cms.djangoapps.contentstore.storage import course_import_export_storage
from openedx.core.lib import ensure_cms
from xmodule.capa_block import ProblemBlock
from xmodule.library_content_block import ANY_CAPA_TYPE_VALUE, LegacyLibraryContentBlock
from xmodule.modulestore import ModuleStoreEnum
from xmodule.modulestore.django import modulestore
Expand Down
13 changes: 2 additions & 11 deletions openedx/envs/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -2167,15 +2167,6 @@ def add_optional_apps(optional_apps, installed_apps):
# .. toggle_target_removal_date: 2026-04-10
USE_EXTRACTED_DISCUSSION_BLOCK = True

# .. toggle_name: USE_EXTRACTED_PROBLEM_BLOCK
# .. toggle_default: False
# .. toggle_implementation: DjangoSetting
# .. toggle_description: Enables the use of the extracted Problem XBlock, which has been shifted to the 'openedx/xblocks-core' repo.
# .. toggle_use_cases: temporary
# .. toggle_warning: Not production-ready until relevant subtask https://github.com/openedx/edx-platform/issues/34827 is done.
# .. toggle_creation_date: 2024-11-10
# .. toggle_target_removal_date: 2026-04-10
USE_EXTRACTED_PROBLEM_BLOCK = True

# .. toggle_name: USE_EXTRACTED_VIDEO_BLOCK
# .. toggle_default: True
Expand Down Expand Up @@ -2281,10 +2272,10 @@ def add_optional_apps(optional_apps, installed_apps):
ENABLE_CODEJAIL_REST_SERVICE = False

# .. setting_name: CODE_JAIL_REST_SERVICE_REMOTE_EXEC
# .. setting_default: 'xmodule.capa.safe_exec.remote_exec.send_safe_exec_request_v0'
# .. setting_default: 'xblock_problem.capa.safe_exec.remote_exec.send_safe_exec_request_v0'
# .. setting_description: Set the python package.module.function that is reponsible of
# calling the remote service in charge of jailed code execution
CODE_JAIL_REST_SERVICE_REMOTE_EXEC = 'xmodule.capa.safe_exec.remote_exec.send_safe_exec_request_v0'
CODE_JAIL_REST_SERVICE_REMOTE_EXEC = 'xblock_problem.capa.safe_exec.remote_exec.send_safe_exec_request_v0'

# .. setting_name: CODE_JAIL_REST_SERVICE_HOST
# .. setting_default: 'http://127.0.0.1:8550'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@
new Show Answer values that remove the Past Due check (keeping the rest intact)
"""

from xblock_problem.block import SHOWANSWER # pylint: disable=wrong-import-order

from lms.djangoapps.courseware.field_overrides import FieldOverrideProvider
from openedx.features.course_experience import RELATIVE_DATES_FLAG
from xmodule.capa_block import SHOWANSWER # pylint: disable=wrong-import-order


class ShowAnswerFieldOverride(FieldOverrideProvider):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
from django.test import RequestFactory
from django.test.utils import override_settings
from edx_toggles.toggles.testutils import override_waffle_flag
from xblock_problem.block import SHOWANSWER # pylint: disable=wrong-import-order

from lms.djangoapps.ccx.tests.test_overrides import inject_field_overrides
from lms.djangoapps.courseware.block_render import get_block
from lms.djangoapps.courseware.model_data import FieldDataCache
from openedx.features.course_experience import RELATIVE_DATES_FLAG
from xmodule.capa_block import SHOWANSWER # pylint: disable=wrong-import-order
from xmodule.modulestore.tests.django_utils import (
ModuleStoreTestCase, # pylint: disable=wrong-import-order
)
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,7 @@ library = "xmodule.library_root_xblock:LibraryRoot"
library_content = "xmodule.library_content_block:LegacyLibraryContentBlock"
lti = "xmodule.lti_block:LTIBlock"
poll_question = "xmodule.poll_block:PollBlock"
problem = "xmodule.capa_block:ProblemBlock"
problem = "xblock_problem:ProblemBlock"
randomize = "xmodule.randomize_block:RandomizeBlock"
sequential = "xmodule.seq_block:SequenceBlock"
slides = "xmodule.template_block:TranslateCustomTagBlock"
Expand Down
8 changes: 0 additions & 8 deletions webpack.builtinblocks.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,6 @@ module.exports = {
'./xmodule/js/src/poll/poll_main.js'
],
PollBlockEditor: './xmodule/js/src/xmodule.js',
ProblemBlockDisplay: [
'./xmodule/js/src/xmodule.js',
'./xmodule/js/src/javascript_loader.js',
'./xmodule/js/src/capa/display.js',
'./xmodule/js/src/collapsible.js',
'./xmodule/js/src/capa/imageinput.js',
'./xmodule/js/src/capa/schematic.js'
],
SequenceBlockDisplay: [
'./xmodule/js/src/xmodule.js',
'./xmodule/js/src/sequence/display.js'
Expand Down
29 changes: 1 addition & 28 deletions webpack.common.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ module.exports = Merge.merge({
* modules here. It is very likely that many of these modules do not need to be in this list. Future
* refactorings are welcome to try to prune the list down to the minimal set of modules. As far as
* we know, the only modules that absolutely need to be added to the global namespace are those
* which define module types, for example "Problem" (in xmodule/js/src/capa/display.js).
* which define module types.
*/
{
test: /xmodule\/assets\/word_cloud\/src\/js\/word_cloud.js/,
Expand Down Expand Up @@ -331,33 +331,6 @@ module.exports = Merge.merge({
}
]
},
{
test: /xmodule\/js\/src\/capa\/display.js/,
use: [
{
loader: 'imports-loader',
options: 'this=>window'
}
]
},
{
test: /xmodule\/js\/src\/capa\/imageinput.js/,
use: [
{
loader: 'imports-loader',
options: 'this=>window'
}
]
},
{
test: /xmodule\/js\/src\/capa\/schematic.js/,
use: [
{
loader: 'imports-loader',
options: 'this=>window'
}
]
},
{
test: /xmodule\/js\/src\/collapsible.js/,
use: [
Expand Down
Empty file.
20 changes: 0 additions & 20 deletions xmodule/capa/safe_exec/remote_exec.py

This file was deleted.

Loading
Loading