Allow for Extracted Word Cloud Block | Fix Test Cases#35983
Allow for Extracted Word Cloud Block | Fix Test Cases#35983kdmccormick merged 7 commits intomasterfrom
Conversation
8cf696a to
988cb0c
Compare
ad5a8b7 to
02848a2
Compare
feanil
left a comment
There was a problem hiding this comment.
I took a pass but since I'm not as familiar with the Xblock framework, forgive me if some of the questions have obvious answers. I'm in particular confused about why the tests need to change and if that indicates any sort of breakage that we need to handle elsewhere?
|
|
||
| assert fragment.content == self.runtime.render_template('word_cloud.html', expected_context) | ||
| if settings.USE_EXTRACTED_WORD_CLOUD_BLOCK: | ||
| expected_context['range_num_inputs'] = range(5) |
There was a problem hiding this comment.
Why not check the block type in this case?
There was a problem hiding this comment.
Fixed, checking for both (Builtin & Extracted) XBlocks now.
xmodule/tests/test_word_cloud.py
Outdated
| if settings.USE_EXTRACTED_WORD_CLOUD_BLOCK: | ||
| def_id = runtime.id_generator.create_definition(olx_element.tag, olx_element.get('url_name')) | ||
| keys = ScopeIds(None, olx_element.tag, def_id, runtime.id_generator.create_usage(def_id)) | ||
| block = WordCloudBlock.parse_xml(olx_element, runtime, keys) |
There was a problem hiding this comment.
Why do keys need to be provided for one instantiation but not the other?
There was a problem hiding this comment.
Update:
I have added keys for both builtin and extracted implementation to avoid If condition.
Why It's not needed in case of builtin xblock implementation?
In BuiltIn xblock implementation WordCloud block has XmlMixin and in its parse_xml method implementation, there is a check at start that if keys are None then it creates the keys.
I have copied the same lines of code and added them in test case.
In Extracted XBlock implementation parse_xml method of xblocks/core.py calls which doesn't have this check and expecting keys values in params.
| # This will export the olx to a separate file. | ||
| block.add_xml_to_node(node) | ||
| if settings.USE_EXTRACTED_WORD_CLOUD_BLOCK: | ||
| filepath = 'word_cloud/block_id.xml' |
There was a problem hiding this comment.
Why not use the same method as below to export the file?
There was a problem hiding this comment.
Because add_xml_to_node is defined in XmlMixin class.
BuiltIn XBlocks are using this mixin
In Extracted XBlocks we are preferring to use Xblock.core functionalities and using export_to_xml method which doesn't have export_to_file funcationlity like add_xml_to_node method of XmlMixin has
@feanil Thanks for the pass. Let's keep this PR in draft until I make this PR and Extracted Word Cloud PR openedx/xblocks-contrib#4 fully ready. |
3f0447a to
add935e
Compare
5768e3b to
d23a0a6
Compare
|
@feanil You can consider this PR to be ready for next pass |
|
Sandbox deployment failed 💥 |
|
Sandbox deployment failed 💥 |
|
@kdmccormick You can ignore last comment if didn't read yet. PR is available for the next pass. Problem Cause: So it was just |
|
Sandbox deployment failed 💥 |
|
Sandbox deployment failed 💥 |
|
Sandbox deployment successful 🚀 |
|
From adding the docs against the But before we plan to merge this PR, I want to bring one point into consideration that is the pointer tag issue. I think we can't merge this PR and any of the test PRs until we resolve this issue. Because the extracted blocks don't support the parsing of the pointer tags format properly which can lead to the erroneous parsing of the previously exported Builtin Blocks if they are imported in the pointer tag OLX format (see this comment). For that, I am currently working on this issue. @feanil @kdmccormick please share your thoughts on it. cc to: @openedx/axim-aximprovements |
@kdmccormick @ttqureshi |
|
Great work on the tests. Good point @ttqureshi , I will turn my attention back to the pointer tag issue. I agree with @farhan , we can merge this PR so tests run on the extracted block, but keep the feature flag disabled until pointer tags are fixed. |
|
Sandbox deployment failed 💥 |
|
Sandbox deployment successful 🚀 |
|
2U Release Notice: This PR has been deployed to the edX staging environment in preparation for a release to production. |
|
2U Release Notice: This PR has been deployed to the edX production environment. |
|
2U Release Notice: This PR has been deployed to the edX staging environment in preparation for a release to production. |
|
2U Release Notice: This PR has been deployed to the edX production environment. |
1 similar comment
|
2U Release Notice: This PR has been deployed to the edX production environment. |
|
2U Release Notice: This PR has been deployed to the edX staging environment in preparation for a release to production. |
|
2U Release Notice: This PR has been deployed to the edX production environment. |
1 similar comment
|
2U Release Notice: This PR has been deployed to the edX production environment. |
…35983) Run tests for both the built-in and extracted WordCloud block. The tests are mostly compatible with both versions of the block, except for a few places where the XBlock framework and the built-in XModule system differ which we've had to handle using conditionals. This moves us closer to enabling the extracted WordCloud block by default and eventually removing the built-in block. Part of: openedx#34840
In this PR:
In this PR we have enabled the usage of Extracted Word Cloud XBlock resides inxblocks-contribrepository.