From 24cb3cf9f5cf7feb24eb271f1b5978eec7a0f30a Mon Sep 17 00:00:00 2001 From: "M. Tayyab Tahir Qureshi" <109274085+ttqureshi@users.noreply.github.com> Date: Tue, 16 Dec 2025 18:22:57 +0500 Subject: [PATCH] refactor: enable the Extracted Annotatable, Poll XBlocks Enabled the Extracted Annotatable, Poll XBlocks --------- Co-authored-by: farhan --- openedx/envs/common.py | 4 ++-- requirements/constraints.txt | 4 ---- requirements/edx/base.txt | 6 ++---- requirements/edx/development.txt | 3 +-- requirements/edx/doc.txt | 6 ++---- requirements/edx/testing.txt | 6 ++---- xmodule/tests/test_word_cloud.py | 27 +++------------------------ 7 files changed, 12 insertions(+), 44 deletions(-) diff --git a/openedx/envs/common.py b/openedx/envs/common.py index de9e45f235..2e74bd9c1d 100644 --- a/openedx/envs/common.py +++ b/openedx/envs/common.py @@ -1676,7 +1676,7 @@ USE_EXTRACTED_WORD_CLOUD_BLOCK = False # .. toggle_warning: Not production-ready until https://github.com/openedx/edx-platform/issues/34841 is done. # .. toggle_creation_date: 2024-11-10 # .. toggle_target_removal_date: 2025-06-01 -USE_EXTRACTED_ANNOTATABLE_BLOCK = False +USE_EXTRACTED_ANNOTATABLE_BLOCK = True # .. toggle_name: USE_EXTRACTED_POLL_QUESTION_BLOCK # .. toggle_default: False @@ -1686,7 +1686,7 @@ USE_EXTRACTED_ANNOTATABLE_BLOCK = False # .. toggle_warning: Not production-ready until https://github.com/openedx/edx-platform/issues/34839 is done. # .. toggle_creation_date: 2024-11-10 # .. toggle_target_removal_date: 2025-06-01 -USE_EXTRACTED_POLL_QUESTION_BLOCK = False +USE_EXTRACTED_POLL_QUESTION_BLOCK = True # .. toggle_name: USE_EXTRACTED_LTI_BLOCK # .. toggle_default: False diff --git a/requirements/constraints.txt b/requirements/constraints.txt index 98680924d6..ec8eb782aa 100644 --- a/requirements/constraints.txt +++ b/requirements/constraints.txt @@ -136,7 +136,3 @@ django-debug-toolbar<6.0.0 # Issue: https://github.com/openedx/edx-platform/issues/37435 cryptography<46.0.0 pact-python<3.0.0 - -# This pin will be removed once the following PR is merged -# https://github.com/openedx/xblocks-contrib/pull/120 -xblocks-contrib<0.9.0 diff --git a/requirements/edx/base.txt b/requirements/edx/base.txt index f4e9828682..b65e8e56be 100644 --- a/requirements/edx/base.txt +++ b/requirements/edx/base.txt @@ -1277,10 +1277,8 @@ xblock-utils==4.0.0 # via # edx-sga # xblock-poll -xblocks-contrib==0.8.1 - # via - # -c requirements/constraints.txt - # -r requirements/edx/bundled.in +xblocks-contrib==0.9.0 + # via -r requirements/edx/bundled.in xmlsec==1.3.14 # via # -c requirements/constraints.txt diff --git a/requirements/edx/development.txt b/requirements/edx/development.txt index a915a65309..fb483f41ee 100644 --- a/requirements/edx/development.txt +++ b/requirements/edx/development.txt @@ -2308,9 +2308,8 @@ xblock-utils==4.0.0 # -r requirements/edx/testing.txt # edx-sga # xblock-poll -xblocks-contrib==0.8.1 +xblocks-contrib==0.9.0 # via - # -c requirements/constraints.txt # -r requirements/edx/doc.txt # -r requirements/edx/testing.txt xmlsec==1.3.14 diff --git a/requirements/edx/doc.txt b/requirements/edx/doc.txt index 60affe5974..46cce20575 100644 --- a/requirements/edx/doc.txt +++ b/requirements/edx/doc.txt @@ -1615,10 +1615,8 @@ xblock-utils==4.0.0 # -r requirements/edx/base.txt # edx-sga # xblock-poll -xblocks-contrib==0.8.1 - # via - # -c requirements/constraints.txt - # -r requirements/edx/base.txt +xblocks-contrib==0.9.0 + # via -r requirements/edx/base.txt xmlsec==1.3.14 # via # -c requirements/constraints.txt diff --git a/requirements/edx/testing.txt b/requirements/edx/testing.txt index 699e6d94ac..ce8eea617b 100644 --- a/requirements/edx/testing.txt +++ b/requirements/edx/testing.txt @@ -1708,10 +1708,8 @@ xblock-utils==4.0.0 # -r requirements/edx/base.txt # edx-sga # xblock-poll -xblocks-contrib==0.8.1 - # via - # -c requirements/constraints.txt - # -r requirements/edx/base.txt +xblocks-contrib==0.9.0 + # via -r requirements/edx/base.txt xmlsec==1.3.14 # via # -c requirements/constraints.txt diff --git a/xmodule/tests/test_word_cloud.py b/xmodule/tests/test_word_cloud.py index bc3f18a83c..bf8faf4826 100644 --- a/xmodule/tests/test_word_cloud.py +++ b/xmodule/tests/test_word_cloud.py @@ -1,6 +1,5 @@ """Test for Word Cloud Block functional logic.""" import json -import os from unittest.mock import Mock from django.conf import settings @@ -68,33 +67,13 @@ class _TestWordCloudBase(TestCase): assert block.num_inputs == 3 assert block.num_top_words == 100 - if settings.USE_EXTRACTED_WORD_CLOUD_BLOCK: - # For extracted XBlocks, we need to manually export the XML definition to a file to properly test the - # import/export cycle. This is because extracted XBlocks use XBlock core's `add_xml_to_node` method, - # which does not export the XML to a file like `XmlMixin.add_xml_to_node` does. - filepath = 'word_cloud/block_id.xml' - runtime.export_fs.makedirs(os.path.dirname(filepath), recreate=True) - with runtime.export_fs.open(filepath, 'wb') as fileObj: - runtime.export_to_xml(block, fileObj) - else: - node = etree.Element("unknown_root") - # This will export the olx to a separate file. - block.add_xml_to_node(node) + node = etree.Element("unknown_root") + # This will export the olx to a separate file. + block.add_xml_to_node(node) with runtime.export_fs.open('word_cloud/block_id.xml') as f: exported_xml = f.read() - if settings.USE_EXTRACTED_WORD_CLOUD_BLOCK: - # For extracted XBlocks, we need to remove the `xblock-family` attribute from the exported XML to ensure - # consistency with the original XML. - # This is because extracted XBlocks use the core XBlock's `add_xml_to_node` method, which includes this - # attribute, whereas `XmlMixin.add_xml_to_node` does not. - exported_xml_tree = etree.fromstring(exported_xml.encode('utf-8')) - etree.cleanup_namespaces(exported_xml_tree) - if 'xblock-family' in exported_xml_tree.attrib: - del exported_xml_tree.attrib['xblock-family'] - exported_xml = etree.tostring(exported_xml_tree, encoding='unicode', pretty_print=True) - assert exported_xml == original_xml def test_bad_ajax_request(self):