-
Notifications
You must be signed in to change notification settings - Fork 3.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Test PR | Enable Extracted Word Cloud #35983
base: master
Are you sure you want to change the base?
Conversation
8cf696a
to
988cb0c
Compare
ad5a8b7
to
02848a2
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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?
'element_id': self.block.location.html_id(), | ||
'num_inputs': 5, # default value | ||
'submitted': False, # default value, | ||
} | ||
|
||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not check the block type in this case?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do keys need to be provided for one instantiation but not the other?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Further discussion:
#35983 (comment)
# 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not use the same method as below to export the file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
|
||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As per discussion in pair programming session (@kdmccormick , @ttqureshi ) we are creating scope ids here which shouldn't happen and is a potential bug
5768e3b
to
d23a0a6
Compare
@feanil You can consider this PR to be ready for next pass |
Sandbox deployment failed 💥 |
It's the test PR for this xblocks-contrib repo PR
Steps done in this PR:
lms/envs/common.py
settingsfail-fast: false
in.github/workflows/unit-tests.yml
xblocks-contrib
with following git branched installation.Fix all the failed test case ✅
PR sandbox
Username: openedx
PW: openedx
Settings