Skip to content
Draft
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 lms/djangoapps/course_home_api/outline/tests/test_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -881,7 +881,7 @@ def test_vertical_icon(self, block_categories, expected_icon):

assert vertical_data['icon'] == expected_icon

@patch('xmodule.html_block.HtmlBlock.icon_class', 'video')
@patch('xmodule.x_module.XModuleMixin.icon_class', 'video')
def test_vertical_icon_determined_by_icon_class(self):
"""Test that the API checks the children `icon_class` to determine the icon for the unit."""
self.add_blocks_to_course()
Expand Down
12 changes: 8 additions & 4 deletions lms/djangoapps/courseware/tests/test_block_render.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,11 @@
from xblock.exceptions import NoSuchServiceError
from xblock.field_data import FieldData # lint-amnesty, pylint: disable=wrong-import-order
from xblock.fields import ScopeIds # lint-amnesty, pylint: disable=wrong-import-order
from xblock.runtime import DictKeyValueStore, KvsFieldData # lint-amnesty, pylint: disable=wrong-import-order
from xblock.runtime import ( # lint-amnesty, pylint: disable=wrong-import-order
DictKeyValueStore,
KvsFieldData,
Mixologist, # lint-amnesty, pylint: disable=wrong-import-order
)
from xblock.test.tools import TestRuntime # lint-amnesty, pylint: disable=wrong-import-order
from xblocks_contrib.problem.capa.tests.response_xml_factory import (
OptionResponseXMLFactory, # lint-amnesty, pylint: disable=reimported
Expand Down Expand Up @@ -1931,8 +1935,9 @@ def setUp(self):
@patch('lms.djangoapps.courseware.block_render.has_access', Mock(return_value=True, autospec=True))
def _get_anonymous_id(self, course_id, xblock_class, should_get_deprecated_id: bool): # lint-amnesty, pylint: disable=missing-function-docstring
location = course_id.make_usage_key('dummy_category', 'dummy_name')
mixed_class = Mixologist(settings.XBLOCK_MIXINS).mix(xblock_class)
block = Mock(
spec=xblock_class,
spec=mixed_class,
_field_data=Mock(spec=FieldData, name='field_data'),
location=location,
static_asset_path=None,
Expand All @@ -1951,8 +1956,7 @@ def _get_anonymous_id(self, course_id, xblock_class, should_get_deprecated_id: b
days_early_for_beta=None,
)
block.runtime = ModuleStoreRuntime(None, None, None)
# Use the xblock_class's bind_for_student method
block.bind_for_student = partial(xblock_class.bind_for_student, block)
block.bind_for_student = partial(mixed_class.bind_for_student, block)

if hasattr(xblock_class, 'module_class'):
block.module_class = xblock_class.module_class
Expand Down
4 changes: 2 additions & 2 deletions openedx/envs/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -2087,7 +2087,7 @@ def add_optional_apps(optional_apps, installed_apps):
# .. 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_DISCUSSION_BLOCK = False
USE_EXTRACTED_DISCUSSION_BLOCK = True

# .. toggle_name: USE_EXTRACTED_PROBLEM_BLOCK
# .. toggle_default: False
Expand All @@ -2097,7 +2097,7 @@ def add_optional_apps(optional_apps, installed_apps):
# .. 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 = False
USE_EXTRACTED_PROBLEM_BLOCK = True

# .. toggle_name: USE_EXTRACTED_VIDEO_BLOCK
# .. toggle_default: True
Expand Down
4 changes: 2 additions & 2 deletions requirements/edx/base.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1284,7 +1284,7 @@ wrapt==2.1.2
# via
# -r requirements/edx/kernel.in
# xblocks-contrib
xblock[django]==6.0.0
xblock[django] @ git+https://github.com/openedx/xblock.git@add-required-attrs
# via
# -r requirements/edx/kernel.in
# acid-xblock
Expand All @@ -1310,7 +1310,7 @@ xblock-utils==4.0.0
# via
# edx-sga
# xblock-poll
xblocks-contrib==0.15.3
git+https://github.com/openedx/xblocks-contrib.git@remove-legacy-mixins#egg=xblocks-contrib
# via -r requirements/edx/bundled.in
xmlsec==1.3.14
# via
Expand Down
4 changes: 2 additions & 2 deletions requirements/edx/development.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2308,7 +2308,7 @@ wrapt==2.1.2
# -r requirements/edx/doc.txt
# -r requirements/edx/testing.txt
# xblocks-contrib
xblock[django]==6.0.0
xblock[django] @ git+https://github.com/openedx/xblock.git@add-required-attrs
# via
# -r requirements/edx/doc.txt
# -r requirements/edx/testing.txt
Expand Down Expand Up @@ -2343,7 +2343,7 @@ xblock-utils==4.0.0
# -r requirements/edx/testing.txt
# edx-sga
# xblock-poll
xblocks-contrib==0.15.3
git+https://github.com/openedx/xblocks-contrib.git@remove-legacy-mixins#egg=xblocks-contrib
# via
# -r requirements/edx/doc.txt
# -r requirements/edx/testing.txt
Expand Down
4 changes: 2 additions & 2 deletions requirements/edx/doc.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1622,7 +1622,7 @@ wrapt==2.1.2
# via
# -r requirements/edx/base.txt
# xblocks-contrib
xblock[django]==6.0.0
xblock[django] @ git+https://github.com/openedx/xblock.git@add-required-attrs
# via
# -r requirements/edx/base.txt
# acid-xblock
Expand All @@ -1649,7 +1649,7 @@ xblock-utils==4.0.0
# -r requirements/edx/base.txt
# edx-sga
# xblock-poll
xblocks-contrib==0.15.3
git+https://github.com/openedx/xblocks-contrib.git@remove-legacy-mixins#egg=xblocks-contrib
# via -r requirements/edx/base.txt
xmlsec==1.3.14
# via
Expand Down
4 changes: 2 additions & 2 deletions requirements/edx/testing.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1720,7 +1720,7 @@ wrapt==2.1.2
# via
# -r requirements/edx/base.txt
# xblocks-contrib
xblock[django]==6.0.0
xblock[django] @ git+https://github.com/openedx/xblock.git@add-required-attrs
# via
# -r requirements/edx/base.txt
# acid-xblock
Expand All @@ -1747,7 +1747,7 @@ xblock-utils==4.0.0
# -r requirements/edx/base.txt
# edx-sga
# xblock-poll
xblocks-contrib==0.15.3
git+https://github.com/openedx/xblocks-contrib.git@remove-legacy-mixins#egg=xblocks-contrib
# via -r requirements/edx/base.txt
xmlsec==1.3.14
# via
Expand Down
10 changes: 6 additions & 4 deletions xmodule/modulestore/tests/test_xml.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def test_get_courses_for_wiki(self):
"""
Test the get_courses_for_wiki method
"""
store = XMLModuleStore(DATA_DIR, source_dirs=['toy', 'simple'])
store = XMLModuleStore(DATA_DIR, source_dirs=['toy', 'simple'], xblock_mixins=(XModuleMixin,))
for course in store.get_courses():
course_locations = store.get_courses_for_wiki(course.wiki_slug)
assert len(course_locations) == 1
Expand All @@ -90,7 +90,7 @@ def test_has_course(self):
Test the has_course method
"""
check_has_course_method(
XMLModuleStore(DATA_DIR, source_dirs=['toy', 'simple']),
XMLModuleStore(DATA_DIR, source_dirs=['toy', 'simple'], xblock_mixins=(XModuleMixin,)),
CourseKey.from_string('edX/toy/2012_Fall'),
locator_key_fields=CourseLocator.KEY_FIELDS
)
Expand All @@ -99,7 +99,7 @@ def test_branch_setting(self):
"""
Test the branch setting context manager
"""
store = XMLModuleStore(DATA_DIR, source_dirs=['toy'])
store = XMLModuleStore(DATA_DIR, source_dirs=['toy'], xblock_mixins=(XModuleMixin,))
course = store.get_courses()[0]

# XML store allows published_only branch setting
Expand Down Expand Up @@ -152,7 +152,9 @@ def setUp(self):

@patch("xmodule.modulestore.xml.glob.glob", side_effect=glob_tildes_at_end)
def test_tilde_files_ignored(self, _fake_glob): # noqa: PT019
modulestore = XMLModuleStore(DATA_DIR, source_dirs=['course_ignore'], load_error_blocks=False)
modulestore = XMLModuleStore(
DATA_DIR, source_dirs=["course_ignore"], xblock_mixins=(XModuleMixin,), load_error_blocks=False
)
about_location = CourseKey.from_string('edX/course_ignore/2014_Fall').make_usage_key(
'about', 'index',
)
Expand Down
4 changes: 2 additions & 2 deletions xmodule/tests/test_conditional.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
from xmodule.tests.xml import XModuleXmlImportTest
from xmodule.tests.xml import factories as xml
from xmodule.validation import StudioValidationMessage
from xmodule.x_module import AUTHOR_VIEW, STUDENT_VIEW
from xmodule.x_module import AUTHOR_VIEW, STUDENT_VIEW, XModuleMixin

ORG = 'test_org'
COURSE = 'conditional' # name of directory with course data
Expand Down Expand Up @@ -227,7 +227,7 @@ def add_block_as_child_node(block, node):
block.add_xml_to_node(child)
self.test_system = get_test_system(add_get_block_overrides=True)
self.test_system.add_block_as_child_node = add_block_as_child_node
self.modulestore = XMLModuleStore(DATA_DIR, source_dirs=['conditional_and_poll'])
self.modulestore = XMLModuleStore(DATA_DIR, source_dirs=['conditional_and_poll'], xblock_mixins=(XModuleMixin,))
courses = self.modulestore.get_courses()
assert len(courses) == 1
self.course = courses[0]
Expand Down
16 changes: 8 additions & 8 deletions xmodule/tests/test_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def get_course(self, name):
modulestore = XMLModuleStore(
DATA_DIR,
source_dirs=[name],
xblock_mixins=(InheritanceMixin,),
xblock_mixins=(InheritanceMixin, XModuleMixin),
)
courses = modulestore.get_courses()
assert len(courses) == 1
Expand Down Expand Up @@ -461,7 +461,7 @@ def test_policy_loading(self):
def test_static_tabs_import(self):
"""Make sure that the static tabs are imported correctly"""

modulestore = XMLModuleStore(DATA_DIR, source_dirs=['toy'])
modulestore = XMLModuleStore(DATA_DIR, source_dirs=['toy'], xblock_mixins=(XModuleMixin,))

location_tab_syllabus = BlockUsageLocator(CourseLocator("edX", "toy", "2012_Fall", deprecated=True),
"static_tab", "syllabus", deprecated=True)
Expand All @@ -483,7 +483,7 @@ def test_definition_loading(self):
happen--locations should uniquely name definitions. But in
our imperfect XML world, it can (and likely will) happen."""

modulestore = XMLModuleStore(DATA_DIR, source_dirs=['toy', 'two_toys'])
modulestore = XMLModuleStore(DATA_DIR, source_dirs=['toy', 'two_toys'], xblock_mixins=(XModuleMixin,))

location = BlockUsageLocator(CourseLocator("edX", "toy", "2012_Fall", deprecated=True),
"video", "Welcome", deprecated=True)
Expand All @@ -499,7 +499,7 @@ def test_colon_in_url_name(self):

print("Starting import")
# Not using get_courses because we need the modulestore object too afterward
modulestore = XMLModuleStore(DATA_DIR, source_dirs=['toy'])
modulestore = XMLModuleStore(DATA_DIR, source_dirs=['toy'], xblock_mixins=(XModuleMixin,))
courses = modulestore.get_courses()
assert len(courses) == 1
course = courses[0]
Expand Down Expand Up @@ -533,7 +533,7 @@ def test_unicode(self):
exceptions/errors to that effect."""

print("Starting import")
modulestore = XMLModuleStore(DATA_DIR, source_dirs=['test_unicode'])
modulestore = XMLModuleStore(DATA_DIR, source_dirs=['test_unicode'], xblock_mixins=(XModuleMixin,))
courses = modulestore.get_courses()
assert len(courses) == 1
course = courses[0]
Expand All @@ -553,7 +553,7 @@ def test_url_name_mangling(self):
Make sure that url_names are only mangled once.
"""

modulestore = XMLModuleStore(DATA_DIR, source_dirs=['toy'])
modulestore = XMLModuleStore(DATA_DIR, source_dirs=['toy'], xblock_mixins=(XModuleMixin,))

toy_id = CourseKey.from_string('edX/toy/2012_Fall')

Expand All @@ -571,7 +571,7 @@ def test_url_name_mangling(self):
assert len(video.usage_key.block_id) == (len('video_') + 12)

def test_poll_and_conditional_import(self):
modulestore = XMLModuleStore(DATA_DIR, source_dirs=['conditional_and_poll'])
modulestore = XMLModuleStore(DATA_DIR, source_dirs=['conditional_and_poll'], xblock_mixins=(XModuleMixin,))

course = modulestore.get_courses()[0]
chapters = course.get_children()
Expand Down Expand Up @@ -624,7 +624,7 @@ def test_cohort_config(self):
Note: The cohort config on the CourseBlock is no longer used.
See openedx.core.djangoapps.course_groups.models.CourseCohortSettings.
"""
modulestore = XMLModuleStore(DATA_DIR, source_dirs=['toy'])
modulestore = XMLModuleStore(DATA_DIR, source_dirs=['toy'], xblock_mixins=(XModuleMixin,))

toy_id = CourseKey.from_string('edX/toy/2012_Fall')

Expand Down
Loading