Skip to content

Commit

Permalink
chore: Fix issues. Upgrade python reqs.
Browse files Browse the repository at this point in the history
  • Loading branch information
farhan committed Mar 21, 2024
1 parent 5e7f946 commit 93c3d90
Show file tree
Hide file tree
Showing 12 changed files with 32 additions and 23 deletions.
10 changes: 6 additions & 4 deletions requirements/base.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,15 @@ arrow==1.3.0
# via cookiecutter
asgiref==3.8.0
# via django
backports-zoneinfo==0.2.1
# via django
backports-zoneinfo==0.2.1 ; python_version < "3.9"
# via
# -c requirements/constraints.txt
# django
binaryornot==0.4.4
# via cookiecutter
boto3==1.34.66
boto3==1.34.67
# via fs-s3fs
botocore==1.34.66
botocore==1.34.67
# via
# boto3
# s3transfer
Expand Down
1 change: 1 addition & 0 deletions requirements/constraints.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@

# Common constraints for edx repos
-c common_constraints.txt
backports.zoneinfo;python_version<"3.9"
lxml<5.0.0
7 changes: 4 additions & 3 deletions requirements/dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,9 @@ astroid==3.1.0
# via
# pylint
# pylint-celery
backports-zoneinfo==0.2.1
backports-zoneinfo==0.2.1 ; python_version < "3.9"
# via
# -c requirements/constraints.txt
# -r requirements/base.txt
# -r requirements/test.txt
# django
Expand All @@ -37,12 +38,12 @@ binaryornot==0.4.4
# -r requirements/base.txt
# -r requirements/test.txt
# cookiecutter
boto3==1.34.66
boto3==1.34.67
# via
# -r requirements/base.txt
# -r requirements/test.txt
# fs-s3fs
botocore==1.34.66
botocore==1.34.67
# via
# -r requirements/base.txt
# -r requirements/test.txt
Expand Down
7 changes: 4 additions & 3 deletions requirements/quality.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,20 @@ astroid==3.1.0
# via
# pylint
# pylint-celery
backports-zoneinfo==0.2.1
backports-zoneinfo==0.2.1 ; python_version < "3.9"
# via
# -c requirements/constraints.txt
# -r requirements/test.txt
# django
binaryornot==0.4.4
# via
# -r requirements/test.txt
# cookiecutter
boto3==1.34.66
boto3==1.34.67
# via
# -r requirements/test.txt
# fs-s3fs
botocore==1.34.66
botocore==1.34.67
# via
# -r requirements/test.txt
# boto3
Expand Down
7 changes: 4 additions & 3 deletions requirements/test.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,20 @@ asgiref==3.8.0
# via
# -r requirements/base.txt
# django
backports-zoneinfo==0.2.1
backports-zoneinfo==0.2.1 ; python_version < "3.9"
# via
# -c requirements/constraints.txt
# -r requirements/base.txt
# django
binaryornot==0.4.4
# via
# -r requirements/base.txt
# cookiecutter
boto3==1.34.66
boto3==1.34.67
# via
# -r requirements/base.txt
# fs-s3fs
botocore==1.34.66
botocore==1.34.67
# via
# -r requirements/base.txt
# boto3
Expand Down
2 changes: 1 addition & 1 deletion sample_xblocks/basic/content.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ def fallback_view(self, _view_name, context=None):
return Fragment(Template(self.content).substitute(**context))

@classmethod
def parse_xml(cls, node, runtime, keys, id_generator):
def parse_xml(cls, node, runtime, keys):
"""
Parse the XML for an HTML block.
Expand Down
8 changes: 4 additions & 4 deletions sample_xblocks/basic/problem.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,15 @@ class ProblemBlock(XBlock):
has_children = True

@classmethod
def parse_xml(cls, node, runtime, keys, id_generator):
def parse_xml(cls, node, runtime, keys):
block = runtime.construct_xblock_from_class(cls, keys)

# Find <script> children, turn them into script content.
for child in node:
if child.tag == "script":
block.script += child.text
else:
block.runtime.add_node_as_child(block, child, id_generator)
block.runtime.add_node_as_child(block, child)

return block

Expand Down Expand Up @@ -341,12 +341,12 @@ def set_arguments_from_xml(self, node):
self.arguments = arguments

@classmethod
def parse_xml(cls, node, runtime, keys, id_generator):
def parse_xml(cls, node, runtime, keys):
"""
Parse the XML for a checker. A few arguments are handled specially,
then the rest get the usual treatment.
"""
block = super().parse_xml(node, runtime, keys, id_generator)
block = super().parse_xml(node, runtime, keys)
block.set_arguments_from_xml(node)
return block

Expand Down
2 changes: 1 addition & 1 deletion sample_xblocks/basic/test/test_problem.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def test_problem_submission():
Number of upvotes matches entered string
</equality_demo>
</problem_demo>
""", runtime.id_generator)
""")
problem = runtime.get_block(problem_usage_id)
json_data = json.dumps({"vote_count": [{"name": "input", "value": "4"}]})
resp = runtime.handle(problem, 'check', make_request(json_data))
Expand Down
1 change: 0 additions & 1 deletion workbench/runtime.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,6 @@ def __init__(self, user_id=None):
services[service_name] = service

super().__init__(ID_MANAGER, ID_MANAGER, services=services)
self.id_generator = ID_MANAGER
self.user_id = user_id

def get_user_role(self):
Expand Down
2 changes: 1 addition & 1 deletion workbench/scenarios.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def add_xml_scenario(scname, description, xml):
# (because the generator will be contextual), so we
# pass it explicitly to parse_xml_string.
runtime.id_generator.set_scenario(slugify(description))
usage_id = runtime.parse_xml_string(xml, runtime.id_generator)
usage_id = runtime.parse_xml_string(xml)
SCENARIOS[scname] = Scenario(description, usage_id, xml)


Expand Down
6 changes: 5 additions & 1 deletion workbench/test/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,11 @@ def test_xblock_with_handler():
assert the_data == "defxx"


@temp_scenario(XBlock)
class XBlockWithoutHandler(XBlock):
pass


@temp_scenario(XBlockWithoutHandler)
def test_xblock_without_handler():
# Test that an XBlock without a handler raises an Exception
# when we try to hit a handler on it
Expand Down
2 changes: 1 addition & 1 deletion workbench/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def load_scenario(self, xml_path):
XBlock
"""
block_id = self.runtime.parse_xml_string(
self.load_fixture_str(xml_path), self.runtime.id_generator
self.load_fixture_str(xml_path)
)
return self.runtime.get_block(block_id)

Expand Down

0 comments on commit 93c3d90

Please sign in to comment.