From 9eba9f983a3944977e02aaf47f60627d53725de1 Mon Sep 17 00:00:00 2001 From: Soban Javed Date: Mon, 16 May 2022 20:20:18 +0500 Subject: [PATCH] refactor!: move common/lib/capa/capa to xmodule/capa As part of dissolving our sub-projects in edx-platform, we are moving this package under the xmodule directory. We have fixed all the occurences of import of this package and also fixed all documents related references. This might break your platform if you have any reference of `import capa` or `from capa import` in your codebase or in any Xblock. Ref: https://openedx.atlassian.net/browse/BOM-2582 --- .coveragerc | 1 - .coveragerc-local | 1 - .eslintignore | 8 ++-- .github/workflows/unit-test-shards.json | 6 --- .github/workflows/unit-tests.yml | 3 +- .../workflows/verify-gha-unit-tests-count.yml | 2 +- cms/envs/common.py | 4 +- common/lib/capa/setup.py | 14 ------ conf/locale/babel_mako.cfg | 4 +- docs/guides/conf.py | 2 - docs/guides/docstrings/common_lib.rst | 2 - docs/guides/testing/testing.rst | 4 +- lms/djangoapps/ccx/tests/test_views.py | 3 +- lms/djangoapps/courseware/module_render.py | 2 +- .../courseware/tests/test_entrance_exam.py | 3 +- .../courseware/tests/test_masquerade.py | 2 +- .../courseware/tests/test_module_render.py | 4 +- .../tests/test_submitting_problems.py | 4 +- lms/djangoapps/courseware/tests/test_views.py | 4 +- .../v1/tests/test_grading_policy_view.py | 3 +- lms/djangoapps/grades/tests/base.py | 4 +- .../grades/tests/integration/test_access.py | 2 +- .../grades/tests/integration/test_events.py | 2 +- .../grades/tests/integration/test_problems.py | 3 +- .../instructor/tests/test_enrollment.py | 2 +- .../instructor/tests/test_spoc_gradebook.py | 2 +- .../tasks_helper/module_state.py | 2 +- .../instructor_task/tests/test_base.py | 2 +- .../instructor_task/tests/test_integration.py | 10 ++-- .../tests/test_tasks_helper.py | 4 +- lms/envs/common.py | 9 ++-- .../content/block_structure/tasks.py | 2 +- requirements/edx/base.txt | 2 - requirements/edx/development.txt | 2 - requirements/edx/local.in | 1 - requirements/edx/testing.txt | 2 - scripts/verify-dunder-init.sh | 3 +- {common/lib/capa => xmodule}/capa/__init__.py | 0 .../lib/capa => xmodule}/capa/capa_problem.py | 14 +++--- {common/lib/capa => xmodule}/capa/checker.py | 2 +- .../lib/capa => xmodule}/capa/correctmap.py | 0 .../lib/capa => xmodule}/capa/customrender.py | 0 .../lib/capa => xmodule}/capa/inputtypes.py | 2 +- {common/lib/capa => xmodule}/capa/registry.py | 0 .../capa => xmodule}/capa/responsetypes.py | 4 +- .../capa/safe_exec/README.rst | 0 .../capa/safe_exec/__init__.py | 0 .../capa/safe_exec/exceptions.py | 0 .../capa/safe_exec/lazymod.py | 0 .../capa/safe_exec/remote_exec.py | 6 +-- .../capa/safe_exec/safe_exec.py | 0 .../capa/safe_exec/tests/__init__.py | 0 .../tests/test_files/pylib/constant.py | 0 .../capa/safe_exec/tests/test_lazymod.py | 2 +- .../capa/safe_exec/tests/test_safe_exec.py | 2 +- .../capa/templates/annotationinput.html | 0 .../capa/templates/chemicalequationinput.html | 2 +- .../capa/templates/choicegroup.html | 0 .../capa/templates/choicetext.html | 2 +- .../capa/templates/clarification.html | 0 .../capa/templates/codeinput.html | 0 .../capa/templates/crystallography.html | 0 .../capa/templates/designprotein2dinput.html | 0 .../capa/templates/drag_and_drop_input.html | 0 .../capa/templates/editageneinput.html | 0 .../capa/templates/editamolecule.html | 0 .../capa/templates/filesubmission.html | 0 .../capa/templates/formulaequationinput.html | 0 .../capa/templates/imageinput.html | 0 .../capa/templates/jsinput.html | 0 .../capa/templates/mathstring.html | 0 .../capa/templates/matlabinput.html | 0 .../capa/templates/optioninput.html | 0 .../capa/templates/schematicinput.html | 2 +- .../capa/templates/solutionspan.html | 0 .../capa/templates/status_span.html | 0 .../capa/templates/textline.html | 0 .../capa/templates/vsepr_input.html | 0 .../capa => xmodule}/capa/tests/__init__.py | 0 .../capa => xmodule}/capa/tests/helpers.py | 4 +- .../capa/tests/response_xml_factory.py | 0 .../capa/tests/test_answer_pool.py | 4 +- .../capa/tests/test_capa_problem.py | 4 +- .../capa/tests/test_correctmap.py | 4 +- .../capa/tests/test_customrender.py | 4 +- .../capa/tests/test_files/dynamath_input.txt | 0 .../capa/tests/test_files/extended_hints.xml | 0 .../test_files/extended_hints_checkbox.xml | 0 .../test_files/extended_hints_dropdown.xml | 0 .../extended_hints_multiple_choice.xml | 0 ...tended_hints_multiple_choice_with_html.xml | 0 .../extended_hints_numeric_input.xml | 0 .../test_files/extended_hints_text_input.xml | 0 .../test_files/extended_hints_with_errors.xml | 0 .../test_files/filename_convert_test.txt | 0 .../test_files/js/mersenne-twister-min.js | 0 .../test_files/js/test_problem_display.js | 0 .../test_files/js/test_problem_generator.js | 0 .../test_files/js/test_problem_grader.js | 0 .../capa/tests/test_files/js/xproblem.js | 0 .../tests/test_files/snuggletex_2x+3y.xml | 0 .../tests/test_files/snuggletex_correct.html | 0 .../tests/test_files/snuggletex_wrong.html | 0 .../tests/test_files/snuggletex_x+x+3y.xml | 0 .../tests/test_files/targeted_feedback.xml | 0 .../test_files/targeted_feedback_multiple.xml | 0 .../capa/tests/test_hint_functionality.py | 2 +- .../capa/tests/test_html_render.py | 2 +- .../capa/tests/test_input_templates.py | 4 +- .../capa/tests/test_inputtypes.py | 32 ++++++------- .../capa/tests/test_responsetypes.py | 20 ++++---- .../capa/tests/test_shuffle.py | 4 +- .../capa/tests/test_targeted_feedback.py | 2 +- .../capa => xmodule}/capa/tests/test_util.py | 4 +- .../capa/tests/test_xqueue_interface.py | 2 +- {common/lib/capa => xmodule}/capa/util.py | 0 .../capa => xmodule}/capa/xqueue_interface.py | 0 xmodule/capa_module.py | 14 +++--- xmodule/library_content_module.py | 2 +- xmodule/tests/__init__.py | 2 +- xmodule/tests/test_capa_module.py | 48 +++++++++---------- 121 files changed, 144 insertions(+), 182 deletions(-) delete mode 100644 common/lib/capa/setup.py rename {common/lib/capa => xmodule}/capa/__init__.py (100%) rename {common/lib/capa => xmodule}/capa/capa_problem.py (99%) rename {common/lib/capa => xmodule}/capa/checker.py (99%) rename {common/lib/capa => xmodule}/capa/correctmap.py (100%) rename {common/lib/capa => xmodule}/capa/customrender.py (100%) rename {common/lib/capa => xmodule}/capa/inputtypes.py (99%) rename {common/lib/capa => xmodule}/capa/registry.py (100%) rename {common/lib/capa => xmodule}/capa/responsetypes.py (99%) rename {common/lib/capa => xmodule}/capa/safe_exec/README.rst (100%) rename {common/lib/capa => xmodule}/capa/safe_exec/__init__.py (100%) rename {common/lib/capa => xmodule}/capa/safe_exec/exceptions.py (100%) rename {common/lib/capa => xmodule}/capa/safe_exec/lazymod.py (100%) rename {common/lib/capa => xmodule}/capa/safe_exec/remote_exec.py (100%) rename {common/lib/capa => xmodule}/capa/safe_exec/safe_exec.py (100%) rename {common/lib/capa => xmodule}/capa/safe_exec/tests/__init__.py (100%) rename {common/lib/capa => xmodule}/capa/safe_exec/tests/test_files/pylib/constant.py (100%) rename {common/lib/capa => xmodule}/capa/safe_exec/tests/test_lazymod.py (97%) rename {common/lib/capa => xmodule}/capa/safe_exec/tests/test_safe_exec.py (99%) rename {common/lib/capa => xmodule}/capa/templates/annotationinput.html (100%) rename {common/lib/capa => xmodule}/capa/templates/chemicalequationinput.html (93%) rename {common/lib/capa => xmodule}/capa/templates/choicegroup.html (100%) rename {common/lib/capa => xmodule}/capa/templates/choicetext.html (98%) rename {common/lib/capa => xmodule}/capa/templates/clarification.html (100%) rename {common/lib/capa => xmodule}/capa/templates/codeinput.html (100%) rename {common/lib/capa => xmodule}/capa/templates/crystallography.html (100%) rename {common/lib/capa => xmodule}/capa/templates/designprotein2dinput.html (100%) rename {common/lib/capa => xmodule}/capa/templates/drag_and_drop_input.html (100%) rename {common/lib/capa => xmodule}/capa/templates/editageneinput.html (100%) rename {common/lib/capa => xmodule}/capa/templates/editamolecule.html (100%) rename {common/lib/capa => xmodule}/capa/templates/filesubmission.html (100%) rename {common/lib/capa => xmodule}/capa/templates/formulaequationinput.html (100%) rename {common/lib/capa => xmodule}/capa/templates/imageinput.html (100%) rename {common/lib/capa => xmodule}/capa/templates/jsinput.html (100%) rename {common/lib/capa => xmodule}/capa/templates/mathstring.html (100%) rename {common/lib/capa => xmodule}/capa/templates/matlabinput.html (100%) rename {common/lib/capa => xmodule}/capa/templates/optioninput.html (100%) rename {common/lib/capa => xmodule}/capa/templates/schematicinput.html (92%) rename {common/lib/capa => xmodule}/capa/templates/solutionspan.html (100%) rename {common/lib/capa => xmodule}/capa/templates/status_span.html (100%) rename {common/lib/capa => xmodule}/capa/templates/textline.html (100%) rename {common/lib/capa => xmodule}/capa/templates/vsepr_input.html (100%) rename {common/lib/capa => xmodule}/capa/tests/__init__.py (100%) rename {common/lib/capa => xmodule}/capa/tests/helpers.py (97%) rename {common/lib/capa => xmodule}/capa/tests/response_xml_factory.py (100%) rename {common/lib/capa => xmodule}/capa/tests/test_answer_pool.py (99%) rename {common/lib/capa => xmodule}/capa/tests/test_capa_problem.py (99%) rename {common/lib/capa => xmodule}/capa/tests/test_correctmap.py (98%) rename {common/lib/capa => xmodule}/capa/tests/test_customrender.py (96%) rename {common/lib/capa => xmodule}/capa/tests/test_files/dynamath_input.txt (100%) rename {common/lib/capa => xmodule}/capa/tests/test_files/extended_hints.xml (100%) rename {common/lib/capa => xmodule}/capa/tests/test_files/extended_hints_checkbox.xml (100%) rename {common/lib/capa => xmodule}/capa/tests/test_files/extended_hints_dropdown.xml (100%) rename {common/lib/capa => xmodule}/capa/tests/test_files/extended_hints_multiple_choice.xml (100%) rename {common/lib/capa => xmodule}/capa/tests/test_files/extended_hints_multiple_choice_with_html.xml (100%) rename {common/lib/capa => xmodule}/capa/tests/test_files/extended_hints_numeric_input.xml (100%) rename {common/lib/capa => xmodule}/capa/tests/test_files/extended_hints_text_input.xml (100%) rename {common/lib/capa => xmodule}/capa/tests/test_files/extended_hints_with_errors.xml (100%) rename {common/lib/capa => xmodule}/capa/tests/test_files/filename_convert_test.txt (100%) rename {common/lib/capa => xmodule}/capa/tests/test_files/js/mersenne-twister-min.js (100%) rename {common/lib/capa => xmodule}/capa/tests/test_files/js/test_problem_display.js (100%) rename {common/lib/capa => xmodule}/capa/tests/test_files/js/test_problem_generator.js (100%) rename {common/lib/capa => xmodule}/capa/tests/test_files/js/test_problem_grader.js (100%) rename {common/lib/capa => xmodule}/capa/tests/test_files/js/xproblem.js (100%) rename {common/lib/capa => xmodule}/capa/tests/test_files/snuggletex_2x+3y.xml (100%) rename {common/lib/capa => xmodule}/capa/tests/test_files/snuggletex_correct.html (100%) rename {common/lib/capa => xmodule}/capa/tests/test_files/snuggletex_wrong.html (100%) rename {common/lib/capa => xmodule}/capa/tests/test_files/snuggletex_x+x+3y.xml (100%) rename {common/lib/capa => xmodule}/capa/tests/test_files/targeted_feedback.xml (100%) rename {common/lib/capa => xmodule}/capa/tests/test_files/targeted_feedback_multiple.xml (100%) rename {common/lib/capa => xmodule}/capa/tests/test_hint_functionality.py (99%) rename {common/lib/capa => xmodule}/capa/tests/test_html_render.py (99%) rename {common/lib/capa => xmodule}/capa/tests/test_input_templates.py (99%) rename {common/lib/capa => xmodule}/capa/tests/test_inputtypes.py (98%) rename {common/lib/capa => xmodule}/capa/tests/test_responsetypes.py (99%) rename {common/lib/capa => xmodule}/capa/tests/test_shuffle.py (99%) rename {common/lib/capa => xmodule}/capa/tests/test_targeted_feedback.py (99%) rename {common/lib/capa => xmodule}/capa/tests/test_util.py (98%) rename {common/lib/capa => xmodule}/capa/tests/test_xqueue_interface.py (94%) rename {common/lib/capa => xmodule}/capa/util.py (100%) rename {common/lib/capa => xmodule}/capa/xqueue_interface.py (100%) diff --git a/.coveragerc b/.coveragerc index 397a19c100b0..b48299d3d744 100644 --- a/.coveragerc +++ b/.coveragerc @@ -4,7 +4,6 @@ data_file = reports/${TEST_SUITE}.coverage source = cms common/djangoapps - common/lib/capa lms openedx pavelib diff --git a/.coveragerc-local b/.coveragerc-local index a6513888351b..f14fdeea9ce2 100644 --- a/.coveragerc-local +++ b/.coveragerc-local @@ -4,7 +4,6 @@ data_file = reports/.coverage source = cms common/djangoapps - common/lib/capa common/lib/xmodule lms openedx diff --git a/.eslintignore b/.eslintignore index 87fc6073da61..82cdcd00dc04 100644 --- a/.eslintignore +++ b/.eslintignore @@ -46,10 +46,10 @@ cms/static/js/spec/views/course_info_spec.js cms/static/js/spec/views/metadata_edit_spec.js cms/static/js/spec/views/textbook_spec.js cms/static/js/spec/views/upload_spec.js -common/lib/capa/capa/tests/test_files/js/test_problem_display.js -common/lib/capa/capa/tests/test_files/js/test_problem_generator.js -common/lib/capa/capa/tests/test_files/js/test_problem_grader.js -common/lib/capa/capa/tests/test_files/js/xproblem.js +xmodule/capa/tests/test_files/js/test_problem_display.js +xmodule/capa/tests/test_files/js/test_problem_generator.js +xmodule/capa/tests/test_files/js/test_problem_grader.js +xmodule/capa/tests/test_files/js/xproblem.js lms/static/js/spec/calculator_spec.js lms/static/js/spec/courseware_spec.js lms/static/js/spec/feedback_form_spec.js diff --git a/.github/workflows/unit-test-shards.json b/.github/workflows/unit-test-shards.json index 81a618f1e687..1ca3f847fec4 100644 --- a/.github/workflows/unit-test-shards.json +++ b/.github/workflows/unit-test-shards.json @@ -261,12 +261,6 @@ ] }, "common-2": { - "settings": "lms.envs.test", - "paths": [ - "common/lib/" - ] - }, - "common-3": { "settings": "cms.envs.test", "paths": [ "common/djangoapps/" diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml index dfe2412a24c4..3b17418e58e0 100644 --- a/.github/workflows/unit-tests.yml +++ b/.github/workflows/unit-tests.yml @@ -31,7 +31,6 @@ jobs: "cms-2", "common-1", "common-2", - "common-3", "xmodule-1" ] @@ -62,7 +61,7 @@ jobs: - name: install requirements run: | sudo pip install -r requirements/pip.txt - sudo pip install -r requirements/edx/testing.txt + sudo pip install --exists-action='w' -r requirements/edx/testing.txt if [[ "${{ matrix.django-version }}" == "pinned" ]]; then sudo pip install -r requirements/edx/django.txt else diff --git a/.github/workflows/verify-gha-unit-tests-count.yml b/.github/workflows/verify-gha-unit-tests-count.yml index 70e2295752d8..8b5701af4830 100644 --- a/.github/workflows/verify-gha-unit-tests-count.yml +++ b/.github/workflows/verify-gha-unit-tests-count.yml @@ -18,7 +18,7 @@ jobs: - name: install requirements run: | sudo pip install -r requirements/pip.txt - sudo pip install -r requirements/edx/testing.txt + sudo pip install --exists-action='w' -r requirements/edx/testing.txt - name: verify unit tests count uses: ./.github/actions/verify-tests-count diff --git a/cms/envs/common.py b/cms/envs/common.py index 1dcb0684872d..f6e41e853489 100644 --- a/cms/envs/common.py +++ b/cms/envs/common.py @@ -1112,10 +1112,10 @@ # Cojail REST service ENABLE_CODEJAIL_REST_SERVICE = False # .. setting_name: CODE_JAIL_REST_SERVICE_REMOTE_EXEC -# .. setting_default: 'capa.safe_exec.remote_exec.send_safe_exec_request_v0' +# .. setting_default: 'xmodule.capa.safe_exec.remote_exec.send_safe_exec_request_v0' # .. setting_description: Set the python package.module.function that is reponsible of # calling the remote service in charge of jailed code execution -CODE_JAIL_REST_SERVICE_REMOTE_EXEC = 'capa.safe_exec.remote_exec.send_safe_exec_request_v0' +CODE_JAIL_REST_SERVICE_REMOTE_EXEC = 'xmodule.capa.safe_exec.remote_exec.send_safe_exec_request_v0' # .. setting_name: CODE_JAIL_REST_SERVICE_HOST # .. setting_default: 'http://127.0.0.1:8550' # .. setting_description: Set the codejail remote service host diff --git a/common/lib/capa/setup.py b/common/lib/capa/setup.py deleted file mode 100644 index d2ea877cb90e..000000000000 --- a/common/lib/capa/setup.py +++ /dev/null @@ -1,14 +0,0 @@ -# lint-amnesty, pylint: disable=missing-module-docstring - -from setuptools import find_packages, setup - -setup( - name="capa", - version="0.1", - packages=find_packages(exclude=["tests"]), - install_requires=[ - "setuptools", - "lxml", - "pytz" - ], -) diff --git a/conf/locale/babel_mako.cfg b/conf/locale/babel_mako.cfg index d009a4ee4c37..5c940572db4d 100644 --- a/conf/locale/babel_mako.cfg +++ b/conf/locale/babel_mako.cfg @@ -11,7 +11,7 @@ # lms/templates # lms/djangoapps/APPNAME/templates # openedx/**/templates -# common/lib/capa/capa/templates +# xmodule/capa/templates # # Don't extract from these directory trees: # common/test/test_microsites/test_microsite/templates @@ -25,7 +25,7 @@ input_encoding = utf-8 input_encoding = utf-8 [mako: */templates/emails/**.txt] input_encoding = utf-8 -[mako: common/lib/capa/capa/templates/**.html] +[mako: xmodule/capa/templates/**.html] input_encoding = utf-8 [mako: openedx/**/templates/**.html] input_encoding = utf-8 diff --git a/docs/guides/conf.py b/docs/guides/conf.py index 09c64ffabfea..fa6e8c3dabe2 100644 --- a/docs/guides/conf.py +++ b/docs/guides/conf.py @@ -20,7 +20,6 @@ # can be successfully imported sys.path.insert(0, root) sys.path.append(root / "docs/guides") -sys.path.append(root / "common/lib/capa") # Use a settings module that allows all LMS and Studio code to be imported @@ -221,7 +220,6 @@ # the generated *.rst files modules = { 'cms': 'cms', - 'common/lib/capa/capa': 'common/lib/capa', 'lms': 'lms', 'openedx': 'openedx', 'xmodule': 'xmodule', diff --git a/docs/guides/docstrings/common_lib.rst b/docs/guides/docstrings/common_lib.rst index dcf884e56fd3..725f712db915 100644 --- a/docs/guides/docstrings/common_lib.rst +++ b/docs/guides/docstrings/common_lib.rst @@ -7,5 +7,3 @@ out from edx-platform into separate packages at some point. .. toctree:: :maxdepth: 2 - - common/lib/capa/modules diff --git a/docs/guides/testing/testing.rst b/docs/guides/testing/testing.rst index f7a10787dfb8..bd232da23131 100644 --- a/docs/guides/testing/testing.rst +++ b/docs/guides/testing/testing.rst @@ -71,7 +71,7 @@ Test Locations - Python unit and integration tests: Located in subpackages called ``tests``. For example, the tests for the ``capa`` package are - located in ``common/lib/capa/capa/tests``. + located in ``xmodule/capa/tests``. - Javascript unit tests: Located in ``spec`` folders. For example, ``xmodule/js/spec`` and @@ -432,7 +432,7 @@ Factories are often implemented using `FactoryBoy`_. In general, factories should be located close to the code they use. For example, the factory for creating problem XML definitions is located in -``common/lib/capa/capa/tests/response_xml_factory.py`` because the +``xmodule/capa/tests/response_xml_factory.py`` because the ``capa`` package handles problem XML. .. _FactoryBoy: https://readthedocs.org/projects/factoryboy/ diff --git a/lms/djangoapps/ccx/tests/test_views.py b/lms/djangoapps/ccx/tests/test_views.py index c3c3f68a005e..d556693fb1d7 100644 --- a/lms/djangoapps/ccx/tests/test_views.py +++ b/lms/djangoapps/ccx/tests/test_views.py @@ -19,13 +19,12 @@ from edx_django_utils.cache import RequestCache from opaque_keys.edx.keys import CourseKey from pytz import UTC -from capa.tests.response_xml_factory import StringResponseXMLFactory - from xmodule.modulestore import ModuleStoreEnum from xmodule.modulestore.django import modulestore from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase, SharedModuleStoreTestCase from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory, SampleCourseFactory from xmodule.x_module import XModuleMixin +from xmodule.capa.tests.response_xml_factory import StringResponseXMLFactory from common.djangoapps.edxmako.shortcuts import render_to_response from common.djangoapps.student.models import CourseEnrollment, CourseEnrollmentAllowed from common.djangoapps.student.roles import CourseCcxCoachRole, CourseInstructorRole, CourseStaffRole diff --git a/lms/djangoapps/courseware/module_render.py b/lms/djangoapps/courseware/module_render.py index 3633ffcc13bf..19b317699175 100644 --- a/lms/djangoapps/courseware/module_render.py +++ b/lms/djangoapps/courseware/module_render.py @@ -48,7 +48,7 @@ from common.djangoapps.static_replace.services import ReplaceURLService from common.djangoapps.static_replace.wrapper import replace_urls_wrapper from common.djangoapps.xblock_django.constants import ATTR_KEY_USER_ID -from capa.xqueue_interface import XQueueService # lint-amnesty, pylint: disable=wrong-import-order +from xmodule.capa.xqueue_interface import XQueueService # lint-amnesty, pylint: disable=wrong-import-order from lms.djangoapps.courseware.access import get_user_role, has_access from lms.djangoapps.courseware.entrance_exams import user_can_skip_entrance_exam, user_has_passed_entrance_exam from lms.djangoapps.courseware.masquerade import ( diff --git a/lms/djangoapps/courseware/tests/test_entrance_exam.py b/lms/djangoapps/courseware/tests/test_entrance_exam.py index 3075bb577c10..d45a4b8058b0 100644 --- a/lms/djangoapps/courseware/tests/test_entrance_exam.py +++ b/lms/djangoapps/courseware/tests/test_entrance_exam.py @@ -7,16 +7,15 @@ from crum import set_current_request from django.urls import reverse from milestones.tests.utils import MilestonesTestCaseMixin -from capa.tests.response_xml_factory import MultipleChoiceResponseXMLFactory from lms.djangoapps.courseware.entrance_exams import ( course_has_entrance_exam, get_entrance_exam_content, user_can_skip_entrance_exam, user_has_passed_entrance_exam ) - from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory +from xmodule.capa.tests.response_xml_factory import MultipleChoiceResponseXMLFactory from lms.djangoapps.courseware.model_data import FieldDataCache from lms.djangoapps.courseware.module_render import get_module, handle_xblock_callback, toc_for_course from lms.djangoapps.courseware.tests.helpers import LoginEnrollmentTestCase diff --git a/lms/djangoapps/courseware/tests/test_masquerade.py b/lms/djangoapps/courseware/tests/test_masquerade.py index dbfdece5d94c..342aa7c96570 100644 --- a/lms/djangoapps/courseware/tests/test_masquerade.py +++ b/lms/djangoapps/courseware/tests/test_masquerade.py @@ -16,7 +16,7 @@ from pytz import UTC from xblock.runtime import DictKeyValueStore -from capa.tests.response_xml_factory import OptionResponseXMLFactory +from xmodule.capa.tests.response_xml_factory import OptionResponseXMLFactory from lms.djangoapps.courseware.masquerade import ( MASQUERADE_SETTINGS_KEY, CourseMasquerade, diff --git a/lms/djangoapps/courseware/tests/test_module_render.py b/lms/djangoapps/courseware/tests/test_module_render.py index d01d2e3f4562..15b33844790d 100644 --- a/lms/djangoapps/courseware/tests/test_module_render.py +++ b/lms/djangoapps/courseware/tests/test_module_render.py @@ -39,8 +39,8 @@ from xblock.runtime import DictKeyValueStore, KvsFieldData, Runtime # lint-amnesty, pylint: disable=wrong-import-order from xblock.test.tools import TestRuntime # lint-amnesty, pylint: disable=wrong-import-order -from capa.tests.response_xml_factory import OptionResponseXMLFactory # lint-amnesty, pylint: disable=reimported -from capa.xqueue_interface import XQueueInterface +from xmodule.capa.tests.response_xml_factory import OptionResponseXMLFactory # lint-amnesty, pylint: disable=reimported +from xmodule.capa.xqueue_interface import XQueueInterface from xmodule.capa_module import ProblemBlock from xmodule.contentstore.django import contentstore from xmodule.html_module import AboutBlock, CourseInfoBlock, HtmlBlock, StaticTabBlock diff --git a/lms/djangoapps/courseware/tests/test_submitting_problems.py b/lms/djangoapps/courseware/tests/test_submitting_problems.py index fa9f38116014..dc5ff1cc1b93 100644 --- a/lms/djangoapps/courseware/tests/test_submitting_problems.py +++ b/lms/djangoapps/courseware/tests/test_submitting_problems.py @@ -22,13 +22,13 @@ from django.utils.timezone import now from submissions import api as submissions_api -from capa.tests.response_xml_factory import ( +from xmodule.capa.tests.response_xml_factory import ( CodeResponseXMLFactory, CustomResponseXMLFactory, OptionResponseXMLFactory, SchematicResponseXMLFactory ) -from capa.xqueue_interface import XQueueInterface +from xmodule.capa.xqueue_interface import XQueueInterface from common.djangoapps.course_modes.models import CourseMode from lms.djangoapps.courseware.models import BaseStudentModuleHistory, StudentModule from lms.djangoapps.courseware.tests.helpers import LoginEnrollmentTestCase diff --git a/lms/djangoapps/courseware/tests/test_views.py b/lms/djangoapps/courseware/tests/test_views.py index 8eea7537e949..17c87108e2a9 100644 --- a/lms/djangoapps/courseware/tests/test_views.py +++ b/lms/djangoapps/courseware/tests/test_views.py @@ -12,7 +12,6 @@ from uuid import uuid4 import ddt -from capa.tests.response_xml_factory import MultipleChoiceResponseXMLFactory from completion.test_utils import CompletionWaffleTestMixin from crum import set_current_request from django.conf import settings @@ -31,6 +30,7 @@ from web_fragments.fragment import Fragment from xblock.core import XBlock from xblock.fields import Scope, String +from xmodule.capa.tests.response_xml_factory import MultipleChoiceResponseXMLFactory from xmodule.data import CertificatesDisplayBehaviors from xmodule.graders import ShowCorrectness from xmodule.modulestore import ModuleStoreEnum @@ -2207,7 +2207,7 @@ def test_user_with_out_passing_grades(self): def test_user_with_passing_grade(self, mock_is_course_passed): # lint-amnesty, pylint: disable=unused-argument # If user has above passing grading then json will return cert generating message and # status valid code - with patch('capa.xqueue_interface.XQueueInterface.send_to_queue') as mock_send_to_queue: + with patch('xmodule.capa.xqueue_interface.XQueueInterface.send_to_queue') as mock_send_to_queue: mock_send_to_queue.return_value = (0, "Successfully queued") resp = self.client.post(self.url) diff --git a/lms/djangoapps/grades/rest_api/v1/tests/test_grading_policy_view.py b/lms/djangoapps/grades/rest_api/v1/tests/test_grading_policy_view.py index c4ba94d94694..a061ef41bec9 100644 --- a/lms/djangoapps/grades/rest_api/v1/tests/test_grading_policy_view.py +++ b/lms/djangoapps/grades/rest_api/v1/tests/test_grading_policy_view.py @@ -8,11 +8,10 @@ import ddt from django.urls import reverse from pytz import UTC -from capa.tests.response_xml_factory import MultipleChoiceResponseXMLFactory - from xmodule.modulestore import ModuleStoreEnum from xmodule.modulestore.tests.django_utils import TEST_DATA_MONGO_AMNESTY_MODULESTORE, SharedModuleStoreTestCase from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory +from xmodule.capa.tests.response_xml_factory import MultipleChoiceResponseXMLFactory from common.djangoapps.student.tests.factories import GlobalStaffFactory from common.djangoapps.student.tests.factories import StaffFactory from common.djangoapps.student.tests.factories import UserFactory diff --git a/lms/djangoapps/grades/tests/base.py b/lms/djangoapps/grades/tests/base.py index 747474a351a0..19cf45bfcc2b 100644 --- a/lms/djangoapps/grades/tests/base.py +++ b/lms/djangoapps/grades/tests/base.py @@ -4,10 +4,10 @@ from crum import set_current_request -from capa.tests.response_xml_factory import MultipleChoiceResponseXMLFactory - from xmodule.modulestore.tests.django_utils import SharedModuleStoreTestCase from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory + +from xmodule.capa.tests.response_xml_factory import MultipleChoiceResponseXMLFactory from common.djangoapps.student.models import CourseEnrollment from common.djangoapps.student.tests.factories import UserFactory from lms.djangoapps.course_blocks.api import get_course_blocks diff --git a/lms/djangoapps/grades/tests/integration/test_access.py b/lms/djangoapps/grades/tests/integration/test_access.py index 15866c520b7a..9149fe64728f 100644 --- a/lms/djangoapps/grades/tests/integration/test_access.py +++ b/lms/djangoapps/grades/tests/integration/test_access.py @@ -5,7 +5,7 @@ from crum import set_current_request -from capa.tests.response_xml_factory import MultipleChoiceResponseXMLFactory +from xmodule.capa.tests.response_xml_factory import MultipleChoiceResponseXMLFactory from common.djangoapps.student.models import CourseEnrollment from common.djangoapps.student.tests.factories import UserFactory from lms.djangoapps.course_blocks.api import get_course_blocks diff --git a/lms/djangoapps/grades/tests/integration/test_events.py b/lms/djangoapps/grades/tests/integration/test_events.py index 27966f86a392..f9b2ba454583 100644 --- a/lms/djangoapps/grades/tests/integration/test_events.py +++ b/lms/djangoapps/grades/tests/integration/test_events.py @@ -6,7 +6,7 @@ from crum import set_current_request -from capa.tests.response_xml_factory import MultipleChoiceResponseXMLFactory +from xmodule.capa.tests.response_xml_factory import MultipleChoiceResponseXMLFactory from common.djangoapps.student.models import CourseEnrollment from common.djangoapps.student.tests.factories import UserFactory from lms.djangoapps.courseware.tests.test_submitting_problems import ProblemSubmissionTestMixin diff --git a/lms/djangoapps/grades/tests/integration/test_problems.py b/lms/djangoapps/grades/tests/integration/test_problems.py index 92b6478c8386..bb25ea047c0b 100644 --- a/lms/djangoapps/grades/tests/integration/test_problems.py +++ b/lms/djangoapps/grades/tests/integration/test_problems.py @@ -5,8 +5,6 @@ import ddt import pytz from crum import set_current_request -from capa.tests.response_xml_factory import MultipleChoiceResponseXMLFactory - from xmodule.graders import ProblemScore from xmodule.modulestore import ModuleStoreEnum from xmodule.modulestore.tests.django_utils import ( @@ -15,6 +13,7 @@ from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory from xmodule.modulestore.tests.utils import TEST_DATA_DIR from xmodule.modulestore.xml_importer import import_course_from_xml +from xmodule.capa.tests.response_xml_factory import MultipleChoiceResponseXMLFactory from common.djangoapps.student.models import CourseEnrollment from common.djangoapps.student.tests.factories import UserFactory from lms.djangoapps.course_blocks.api import get_course_blocks diff --git a/lms/djangoapps/instructor/tests/test_enrollment.py b/lms/djangoapps/instructor/tests/test_enrollment.py index c5cc4989bbf8..ac7ab1749c93 100644 --- a/lms/djangoapps/instructor/tests/test_enrollment.py +++ b/lms/djangoapps/instructor/tests/test_enrollment.py @@ -9,7 +9,6 @@ import ddt import pytest -from capa.tests.response_xml_factory import MultipleChoiceResponseXMLFactory from ccx_keys.locator import CCXLocator from crum import set_current_request from django.conf import settings @@ -20,6 +19,7 @@ from xmodule.modulestore.tests.django_utils import TEST_DATA_MONGO_AMNESTY_MODULESTORE, SharedModuleStoreTestCase from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory +from xmodule.capa.tests.response_xml_factory import MultipleChoiceResponseXMLFactory from common.djangoapps.student.models import CourseEnrollment, CourseEnrollmentAllowed, anonymous_id_for_user from common.djangoapps.student.roles import CourseCcxCoachRole from common.djangoapps.student.tests.factories import AdminFactory, UserFactory diff --git a/lms/djangoapps/instructor/tests/test_spoc_gradebook.py b/lms/djangoapps/instructor/tests/test_spoc_gradebook.py index 5b62e67641d1..1f23ba680794 100644 --- a/lms/djangoapps/instructor/tests/test_spoc_gradebook.py +++ b/lms/djangoapps/instructor/tests/test_spoc_gradebook.py @@ -3,7 +3,7 @@ """ from django.urls import reverse -from capa.tests.response_xml_factory import StringResponseXMLFactory +from xmodule.capa.tests.response_xml_factory import StringResponseXMLFactory from common.djangoapps.student.tests.factories import AdminFactory, CourseEnrollmentFactory, UserFactory from lms.djangoapps.courseware.tests.factories import StudentModuleFactory from lms.djangoapps.grades.api import task_compute_all_grades_for_course diff --git a/lms/djangoapps/instructor_task/tasks_helper/module_state.py b/lms/djangoapps/instructor_task/tasks_helper/module_state.py index 36ba0107a4d9..8095153f00b2 100644 --- a/lms/djangoapps/instructor_task/tasks_helper/module_state.py +++ b/lms/djangoapps/instructor_task/tasks_helper/module_state.py @@ -12,7 +12,7 @@ from xblock.runtime import KvsFieldData from xblock.scorable import Score -from capa.responsetypes import LoncapaProblemError, ResponseError, StudentInputError +from xmodule.capa.responsetypes import LoncapaProblemError, ResponseError, StudentInputError from common.djangoapps.student.models import get_user_by_username_or_email from common.djangoapps.track.event_transaction_utils import create_new_event_transaction_id, set_event_transaction_type from common.djangoapps.track.views import task_track diff --git a/lms/djangoapps/instructor_task/tests/test_base.py b/lms/djangoapps/instructor_task/tests/test_base.py index 14d4b0d04030..75f6eb0b33a9 100644 --- a/lms/djangoapps/instructor_task/tests/test_base.py +++ b/lms/djangoapps/instructor_task/tests/test_base.py @@ -13,7 +13,6 @@ from uuid import uuid4 import unicodecsv -from capa.tests.response_xml_factory import OptionResponseXMLFactory from celery.states import FAILURE, SUCCESS from django.contrib.auth.models import User # lint-amnesty, pylint: disable=imported-auth-user from django.urls import reverse @@ -24,6 +23,7 @@ from xmodule.modulestore.django import modulestore from xmodule.modulestore.tests.django_utils import TEST_DATA_MONGO_AMNESTY_MODULESTORE, ModuleStoreTestCase from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory +from xmodule.capa.tests.response_xml_factory import OptionResponseXMLFactory from common.djangoapps.student.tests.factories import CourseEnrollmentFactory, UserFactory from lms.djangoapps.courseware.model_data import StudentModule from lms.djangoapps.courseware.tests.tests import LoginEnrollmentTestCase diff --git a/lms/djangoapps/instructor_task/tests/test_integration.py b/lms/djangoapps/instructor_task/tests/test_integration.py index 72c07e201c61..db8413046a5e 100644 --- a/lms/djangoapps/instructor_task/tests/test_integration.py +++ b/lms/djangoapps/instructor_task/tests/test_integration.py @@ -20,8 +20,8 @@ from django.test.utils import override_settings from django.urls import reverse -from capa.responsetypes import StudentInputError -from capa.tests.response_xml_factory import CodeResponseXMLFactory, CustomResponseXMLFactory +from xmodule.capa.responsetypes import StudentInputError +from xmodule.capa.tests.response_xml_factory import CodeResponseXMLFactory, CustomResponseXMLFactory from lms.djangoapps.courseware.model_data import StudentModule from lms.djangoapps.grades.api import CourseGradeFactory from lms.djangoapps.instructor_task.api import ( @@ -273,7 +273,7 @@ def test_rescoring_failure(self): self.submit_student_answer('u1', problem_url_name, [OPTION_1, OPTION_1]) expected_message = "bad things happened" - with patch('capa.capa_problem.LoncapaProblem.get_grade_from_current_answers') as mock_rescore: + with patch('xmodule.capa.capa_problem.LoncapaProblem.get_grade_from_current_answers') as mock_rescore: mock_rescore.side_effect = ZeroDivisionError(expected_message) instructor_task = self.submit_rescore_all_student_answers('instructor', problem_url_name) self._assert_task_failure( @@ -293,7 +293,7 @@ def test_rescoring_bad_unicode_input(self): # return an input error as if it were a numerical response, with an embedded unicode character: expected_message = "Could not interpret '2/3\u03a9' as a number" - with patch('capa.capa_problem.LoncapaProblem.get_grade_from_current_answers') as mock_rescore: + with patch('xmodule.capa.capa_problem.LoncapaProblem.get_grade_from_current_answers') as mock_rescore: mock_rescore.side_effect = StudentInputError(expected_message) instructor_task = self.submit_rescore_all_student_answers('instructor', problem_url_name) @@ -332,7 +332,7 @@ def test_rescoring_code_problem(self): problem_url_name = 'H1P2' self.define_code_response_problem(problem_url_name) # we fully create the CodeResponse problem, but just pretend that we're queuing it: - with patch('capa.xqueue_interface.XQueueInterface.send_to_queue') as mock_send_to_queue: + with patch('xmodule.capa.xqueue_interface.XQueueInterface.send_to_queue') as mock_send_to_queue: mock_send_to_queue.return_value = (0, "Successfully queued") self.submit_student_answer('u1', problem_url_name, ["answer1", "answer2"]) diff --git a/lms/djangoapps/instructor_task/tests/test_tasks_helper.py b/lms/djangoapps/instructor_task/tests/test_tasks_helper.py index 1807a8af965f..6fbb4834dbcb 100644 --- a/lms/djangoapps/instructor_task/tests/test_tasks_helper.py +++ b/lms/djangoapps/instructor_task/tests/test_tasks_helper.py @@ -24,7 +24,7 @@ from pytz import UTC import openedx.core.djangoapps.user_api.course_tag.api as course_tag_api -from capa.tests.response_xml_factory import MultipleChoiceResponseXMLFactory # lint-amnesty, pylint: disable=wrong-import-order +from xmodule.capa.tests.response_xml_factory import MultipleChoiceResponseXMLFactory # lint-amnesty, pylint: disable=wrong-import-order from common.djangoapps.course_modes.models import CourseMode from common.djangoapps.student.models import CourseEnrollment, CourseEnrollmentAllowed from common.djangoapps.student.tests.factories import CourseEnrollmentFactory, UserFactory @@ -2488,7 +2488,7 @@ def assertCertificatesGenerated(self, task_input, expected_results): with patch('lms.djangoapps.instructor_task.tasks_helper.runner._get_current_task') as mock_current_task: mock_current_task.return_value = current_task - with patch('capa.xqueue_interface.XQueueInterface.send_to_queue') as mock_queue: + with patch('xmodule.capa.xqueue_interface.XQueueInterface.send_to_queue') as mock_queue: mock_queue.return_value = (0, "Successfully queued") result = generate_students_certificates( None, None, self.course.id, task_input, 'certificates generated' diff --git a/lms/envs/common.py b/lms/envs/common.py index 4cd68a3f297c..d3181256a2a5 100644 --- a/lms/envs/common.py +++ b/lms/envs/common.py @@ -1080,6 +1080,7 @@ REPO_ROOT = PROJECT_ROOT.dirname() COMMON_ROOT = REPO_ROOT / "common" OPENEDX_ROOT = REPO_ROOT / "openedx" +XMODULE_ROOT = REPO_ROOT / "xmodule" ENV_ROOT = REPO_ROOT.dirname() # virtualenv dir /edx-platform is in COURSES_ROOT = ENV_ROOT / "data" NODE_MODULES_ROOT = REPO_ROOT / "node_modules" @@ -1211,7 +1212,7 @@ MAKO_TEMPLATE_DIRS_BASE = [ PROJECT_ROOT / 'templates', COMMON_ROOT / 'templates', - COMMON_ROOT / 'lib' / 'capa' / 'capa' / 'templates', + XMODULE_ROOT / 'capa' / 'templates', COMMON_ROOT / 'djangoapps' / 'pipeline_mako' / 'templates', OPENEDX_ROOT / 'core' / 'djangoapps' / 'cors_csrf' / 'templates', OPENEDX_ROOT / 'core' / 'djangoapps' / 'dark_lang' / 'templates', @@ -1270,7 +1271,7 @@ def _make_mako_template_dirs(settings): 'DIRS': [ PROJECT_ROOT / "templates", COMMON_ROOT / 'templates', - COMMON_ROOT / 'lib' / 'capa' / 'capa' / 'templates', + XMODULE_ROOT / 'capa' / 'templates', COMMON_ROOT / 'djangoapps' / 'pipeline_mako' / 'templates', COMMON_ROOT / 'static', # required to statically include common Underscore templates ], @@ -1702,10 +1703,10 @@ def _make_mako_template_dirs(settings): # Cojail REST service ENABLE_CODEJAIL_REST_SERVICE = False # .. setting_name: CODE_JAIL_REST_SERVICE_REMOTE_EXEC -# .. setting_default: 'common.lib.capa.capa.safe_exec.remote_exec.send_safe_exec_request_v0' +# .. setting_default: 'xmodule.capa.safe_exec.remote_exec.send_safe_exec_request_v0' # .. setting_description: Set the python package.module.function that is reponsible of # calling the remote service in charge of jailed code execution -CODE_JAIL_REST_SERVICE_REMOTE_EXEC = 'common.lib.capa.capa.safe_exec.remote_exec.send_safe_exec_request_v0' +CODE_JAIL_REST_SERVICE_REMOTE_EXEC = 'xmodule.capa.safe_exec.remote_exec.send_safe_exec_request_v0' # .. setting_name: CODE_JAIL_REST_SERVICE_HOST # .. setting_default: 'http://127.0.0.1:8550' # .. setting_description: Set the codejail remote service host diff --git a/openedx/core/djangoapps/content/block_structure/tasks.py b/openedx/core/djangoapps/content/block_structure/tasks.py index 30628ebe00f1..7c3c2805fb10 100644 --- a/openedx/core/djangoapps/content/block_structure/tasks.py +++ b/openedx/core/djangoapps/content/block_structure/tasks.py @@ -12,7 +12,7 @@ from lxml.etree import XMLSyntaxError from opaque_keys.edx.keys import CourseKey -from capa.responsetypes import LoncapaProblemError +from xmodule.capa.responsetypes import LoncapaProblemError from openedx.core.djangoapps.content.block_structure import api from openedx.core.djangoapps.content.block_structure.config import enable_storage_backing_for_cache_in_request from xmodule.modulestore.exceptions import ItemNotFoundError # lint-amnesty, pylint: disable=wrong-import-order diff --git a/requirements/edx/base.txt b/requirements/edx/base.txt index 7beec598f53c..2e505a0326a7 100644 --- a/requirements/edx/base.txt +++ b/requirements/edx/base.txt @@ -6,8 +6,6 @@ # -e git+https://github.com/openedx/blockstore.git@1.2.1#egg=blockstore==1.2.1 # via -r requirements/edx/github.in --e common/lib/capa - # via -r requirements/edx/local.in -e git+https://github.com/edx/codejail.git@3.1.3#egg=codejail==3.1.3 # via -r requirements/edx/github.in -e git+https://github.com/edx/django-wiki.git@1.1.0#egg=django-wiki diff --git a/requirements/edx/development.txt b/requirements/edx/development.txt index 48865c5172a2..26dd6e26cbd0 100644 --- a/requirements/edx/development.txt +++ b/requirements/edx/development.txt @@ -6,8 +6,6 @@ # -e git+https://github.com/openedx/blockstore.git@1.2.1#egg=blockstore==1.2.1 # via -r requirements/edx/testing.txt --e common/lib/capa - # via -r requirements/edx/testing.txt -e git+https://github.com/edx/codejail.git@3.1.3#egg=codejail==3.1.3 # via -r requirements/edx/testing.txt -e git+https://github.com/edx/django-wiki.git@1.1.0#egg=django-wiki diff --git a/requirements/edx/local.in b/requirements/edx/local.in index 2e80f24af3c5..776e718daa80 100644 --- a/requirements/edx/local.in +++ b/requirements/edx/local.in @@ -1,3 +1,2 @@ # Python libraries to install that are local to the edx-platform repo -e . --e common/lib/capa diff --git a/requirements/edx/testing.txt b/requirements/edx/testing.txt index 5ed144b06b5b..a13fb9ebaced 100644 --- a/requirements/edx/testing.txt +++ b/requirements/edx/testing.txt @@ -6,8 +6,6 @@ # -e git+https://github.com/openedx/blockstore.git@1.2.1#egg=blockstore==1.2.1 # via -r requirements/edx/base.txt --e common/lib/capa - # via -r requirements/edx/base.txt -e git+https://github.com/edx/codejail.git@3.1.3#egg=codejail==3.1.3 # via -r requirements/edx/base.txt -e git+https://github.com/edx/django-wiki.git@1.1.0#egg=django-wiki diff --git a/scripts/verify-dunder-init.sh b/scripts/verify-dunder-init.sh index 907df34bb122..7c88feffc6d3 100755 --- a/scripts/verify-dunder-init.sh +++ b/scripts/verify-dunder-init.sh @@ -27,7 +27,7 @@ exclude='' exclude+='^\.$' # Exclude test data that includes Python (do NOT exclude unit test source code, though). -exclude+='|^common/lib/capa/capa/safe_exec/tests/test_files/?.*$' +exclude+='|^xmodule/capa/safe_exec/tests/test_files/?.*$' exclude+='|^common/test/data/?.*$' # Exclude common/lib and its immediate child directories. @@ -38,7 +38,6 @@ exclude+='|^common/test/data/?.*$' # * common/lib/capa -> EXCLUDE from check. # * common/lib/capa/capa/safe_exec -> INCLUDE in check. exclude+='|^common/lib$' -exclude+='|^common/lib/capa$' # xmodule data folder exclude+='|^xmodule/tests/data/xml-course-root/capa$' diff --git a/common/lib/capa/capa/__init__.py b/xmodule/capa/__init__.py similarity index 100% rename from common/lib/capa/capa/__init__.py rename to xmodule/capa/__init__.py diff --git a/common/lib/capa/capa/capa_problem.py b/xmodule/capa/capa_problem.py similarity index 99% rename from common/lib/capa/capa/capa_problem.py rename to xmodule/capa/capa_problem.py index 30295b0919fb..66242b843816 100644 --- a/common/lib/capa/capa/capa_problem.py +++ b/xmodule/capa/capa_problem.py @@ -27,13 +27,13 @@ from lxml import etree from pytz import UTC -import capa.customrender as customrender -import capa.inputtypes as inputtypes -import capa.responsetypes as responsetypes -import capa.xqueue_interface as xqueue_interface -from capa.correctmap import CorrectMap -from capa.safe_exec import safe_exec -from capa.util import contextualize_text, convert_files_to_filenames, get_course_id_from_capa_module +import xmodule.capa.customrender as customrender +import xmodule.capa.inputtypes as inputtypes +import xmodule.capa.responsetypes as responsetypes +import xmodule.capa.xqueue_interface as xqueue_interface +from xmodule.capa.correctmap import CorrectMap +from xmodule.capa.safe_exec import safe_exec +from xmodule.capa.util import contextualize_text, convert_files_to_filenames, get_course_id_from_capa_module from openedx.core.djangolib.markup import HTML, Text from openedx.core.lib.edx_six import get_gettext from xmodule.stringify import stringify_children diff --git a/common/lib/capa/capa/checker.py b/xmodule/capa/checker.py similarity index 99% rename from common/lib/capa/capa/checker.py rename to xmodule/capa/checker.py index c3873085d971..bcbdd85e5260 100755 --- a/common/lib/capa/capa/checker.py +++ b/xmodule/capa/checker.py @@ -13,7 +13,7 @@ from mako.lookup import TemplateLookup from path import Path as path -from capa.capa_problem import LoncapaProblem +from xmodule.capa.capa_problem import LoncapaProblem logging.basicConfig(format="%(levelname)s %(message)s") log = logging.getLogger('capa.checker') diff --git a/common/lib/capa/capa/correctmap.py b/xmodule/capa/correctmap.py similarity index 100% rename from common/lib/capa/capa/correctmap.py rename to xmodule/capa/correctmap.py diff --git a/common/lib/capa/capa/customrender.py b/xmodule/capa/customrender.py similarity index 100% rename from common/lib/capa/capa/customrender.py rename to xmodule/capa/customrender.py diff --git a/common/lib/capa/capa/inputtypes.py b/xmodule/capa/inputtypes.py similarity index 99% rename from common/lib/capa/capa/inputtypes.py rename to xmodule/capa/inputtypes.py index 6adef536a3cd..f1817415ca0b 100644 --- a/common/lib/capa/capa/inputtypes.py +++ b/xmodule/capa/inputtypes.py @@ -57,7 +57,7 @@ from lxml import etree from six import text_type -from capa.xqueue_interface import XQUEUE_TIMEOUT +from xmodule.capa.xqueue_interface import XQUEUE_TIMEOUT from openedx.core.djangolib.markup import HTML, Text from openedx.core.lib import edx_six from xmodule.stringify import stringify_children diff --git a/common/lib/capa/capa/registry.py b/xmodule/capa/registry.py similarity index 100% rename from common/lib/capa/capa/registry.py rename to xmodule/capa/registry.py diff --git a/common/lib/capa/capa/responsetypes.py b/xmodule/capa/responsetypes.py similarity index 99% rename from common/lib/capa/capa/responsetypes.py rename to xmodule/capa/responsetypes.py index 35cc8eaa1cda..39000c544a5b 100644 --- a/common/lib/capa/capa/responsetypes.py +++ b/xmodule/capa/responsetypes.py @@ -43,8 +43,8 @@ from six import text_type from six.moves import map, range, zip -import capa.safe_exec as safe_exec -import capa.xqueue_interface as xqueue_interface +import xmodule.capa.safe_exec as safe_exec +import xmodule.capa.xqueue_interface as xqueue_interface from openedx.core.djangolib.markup import HTML, Text from openedx.core.lib import edx_six from openedx.core.lib.grade_utils import round_away_from_zero diff --git a/common/lib/capa/capa/safe_exec/README.rst b/xmodule/capa/safe_exec/README.rst similarity index 100% rename from common/lib/capa/capa/safe_exec/README.rst rename to xmodule/capa/safe_exec/README.rst diff --git a/common/lib/capa/capa/safe_exec/__init__.py b/xmodule/capa/safe_exec/__init__.py similarity index 100% rename from common/lib/capa/capa/safe_exec/__init__.py rename to xmodule/capa/safe_exec/__init__.py diff --git a/common/lib/capa/capa/safe_exec/exceptions.py b/xmodule/capa/safe_exec/exceptions.py similarity index 100% rename from common/lib/capa/capa/safe_exec/exceptions.py rename to xmodule/capa/safe_exec/exceptions.py diff --git a/common/lib/capa/capa/safe_exec/lazymod.py b/xmodule/capa/safe_exec/lazymod.py similarity index 100% rename from common/lib/capa/capa/safe_exec/lazymod.py rename to xmodule/capa/safe_exec/lazymod.py diff --git a/common/lib/capa/capa/safe_exec/remote_exec.py b/xmodule/capa/safe_exec/remote_exec.py similarity index 100% rename from common/lib/capa/capa/safe_exec/remote_exec.py rename to xmodule/capa/safe_exec/remote_exec.py index 8baf0b71089d..a7aa7f83441c 100644 --- a/common/lib/capa/capa/safe_exec/remote_exec.py +++ b/xmodule/capa/safe_exec/remote_exec.py @@ -2,19 +2,19 @@ Helper methods related to safe exec. """ -import requests import json import logging +from importlib import import_module +import requests from codejail.safe_exec import SafeExecException from django.conf import settings from edx_toggles.toggles import SettingToggle -from importlib import import_module from requests.exceptions import RequestException, HTTPError from simplejson import JSONDecodeError -from .exceptions import CodejailServiceParseError, CodejailServiceStatusError, CodejailServiceUnavailable from django.utils.translation import gettext as _ +from .exceptions import CodejailServiceParseError, CodejailServiceStatusError, CodejailServiceUnavailable log = logging.getLogger(__name__) diff --git a/common/lib/capa/capa/safe_exec/safe_exec.py b/xmodule/capa/safe_exec/safe_exec.py similarity index 100% rename from common/lib/capa/capa/safe_exec/safe_exec.py rename to xmodule/capa/safe_exec/safe_exec.py diff --git a/common/lib/capa/capa/safe_exec/tests/__init__.py b/xmodule/capa/safe_exec/tests/__init__.py similarity index 100% rename from common/lib/capa/capa/safe_exec/tests/__init__.py rename to xmodule/capa/safe_exec/tests/__init__.py diff --git a/common/lib/capa/capa/safe_exec/tests/test_files/pylib/constant.py b/xmodule/capa/safe_exec/tests/test_files/pylib/constant.py similarity index 100% rename from common/lib/capa/capa/safe_exec/tests/test_files/pylib/constant.py rename to xmodule/capa/safe_exec/tests/test_files/pylib/constant.py diff --git a/common/lib/capa/capa/safe_exec/tests/test_lazymod.py b/xmodule/capa/safe_exec/tests/test_lazymod.py similarity index 97% rename from common/lib/capa/capa/safe_exec/tests/test_lazymod.py rename to xmodule/capa/safe_exec/tests/test_lazymod.py index fb7bdda28d3a..548422d7c89e 100644 --- a/common/lib/capa/capa/safe_exec/tests/test_lazymod.py +++ b/xmodule/capa/safe_exec/tests/test_lazymod.py @@ -4,7 +4,7 @@ import sys import unittest -from capa.safe_exec.lazymod import LazyModule +from xmodule.capa.safe_exec.lazymod import LazyModule class ModuleIsolation(object): diff --git a/common/lib/capa/capa/safe_exec/tests/test_safe_exec.py b/xmodule/capa/safe_exec/tests/test_safe_exec.py similarity index 99% rename from common/lib/capa/capa/safe_exec/tests/test_safe_exec.py rename to xmodule/capa/safe_exec/tests/test_safe_exec.py index ea0b9ea67ea5..3ed60c691420 100644 --- a/common/lib/capa/capa/safe_exec/tests/test_safe_exec.py +++ b/xmodule/capa/safe_exec/tests/test_safe_exec.py @@ -19,7 +19,7 @@ from six import text_type, unichr from six.moves import range -from capa.safe_exec import safe_exec, update_hash +from xmodule.capa.safe_exec import safe_exec, update_hash class TestSafeExec(unittest.TestCase): # lint-amnesty, pylint: disable=missing-class-docstring diff --git a/common/lib/capa/capa/templates/annotationinput.html b/xmodule/capa/templates/annotationinput.html similarity index 100% rename from common/lib/capa/capa/templates/annotationinput.html rename to xmodule/capa/templates/annotationinput.html diff --git a/common/lib/capa/capa/templates/chemicalequationinput.html b/xmodule/capa/templates/chemicalequationinput.html similarity index 93% rename from common/lib/capa/capa/templates/chemicalequationinput.html rename to xmodule/capa/templates/chemicalequationinput.html index 3f18a699e68e..ca01d3d7c291 100644 --- a/common/lib/capa/capa/templates/chemicalequationinput.html +++ b/xmodule/capa/templates/chemicalequationinput.html @@ -1,4 +1,4 @@ -<%! from capa.util import remove_markup %> +<%! from xmodule.capa.util import remove_markup %>
diff --git a/common/lib/capa/capa/templates/choicegroup.html b/xmodule/capa/templates/choicegroup.html similarity index 100% rename from common/lib/capa/capa/templates/choicegroup.html rename to xmodule/capa/templates/choicegroup.html diff --git a/common/lib/capa/capa/templates/choicetext.html b/xmodule/capa/templates/choicetext.html similarity index 98% rename from common/lib/capa/capa/templates/choicetext.html rename to xmodule/capa/templates/choicetext.html index e2b5480ed470..64c4226b084b 100644 --- a/common/lib/capa/capa/templates/choicetext.html +++ b/xmodule/capa/templates/choicetext.html @@ -1,4 +1,4 @@ -<%! from capa.util import remove_markup +<%! from xmodule.capa.util import remove_markup from django.utils.translation import ugettext as _ from openedx.core.djangolib.markup import HTML %> diff --git a/common/lib/capa/capa/templates/clarification.html b/xmodule/capa/templates/clarification.html similarity index 100% rename from common/lib/capa/capa/templates/clarification.html rename to xmodule/capa/templates/clarification.html diff --git a/common/lib/capa/capa/templates/codeinput.html b/xmodule/capa/templates/codeinput.html similarity index 100% rename from common/lib/capa/capa/templates/codeinput.html rename to xmodule/capa/templates/codeinput.html diff --git a/common/lib/capa/capa/templates/crystallography.html b/xmodule/capa/templates/crystallography.html similarity index 100% rename from common/lib/capa/capa/templates/crystallography.html rename to xmodule/capa/templates/crystallography.html diff --git a/common/lib/capa/capa/templates/designprotein2dinput.html b/xmodule/capa/templates/designprotein2dinput.html similarity index 100% rename from common/lib/capa/capa/templates/designprotein2dinput.html rename to xmodule/capa/templates/designprotein2dinput.html diff --git a/common/lib/capa/capa/templates/drag_and_drop_input.html b/xmodule/capa/templates/drag_and_drop_input.html similarity index 100% rename from common/lib/capa/capa/templates/drag_and_drop_input.html rename to xmodule/capa/templates/drag_and_drop_input.html diff --git a/common/lib/capa/capa/templates/editageneinput.html b/xmodule/capa/templates/editageneinput.html similarity index 100% rename from common/lib/capa/capa/templates/editageneinput.html rename to xmodule/capa/templates/editageneinput.html diff --git a/common/lib/capa/capa/templates/editamolecule.html b/xmodule/capa/templates/editamolecule.html similarity index 100% rename from common/lib/capa/capa/templates/editamolecule.html rename to xmodule/capa/templates/editamolecule.html diff --git a/common/lib/capa/capa/templates/filesubmission.html b/xmodule/capa/templates/filesubmission.html similarity index 100% rename from common/lib/capa/capa/templates/filesubmission.html rename to xmodule/capa/templates/filesubmission.html diff --git a/common/lib/capa/capa/templates/formulaequationinput.html b/xmodule/capa/templates/formulaequationinput.html similarity index 100% rename from common/lib/capa/capa/templates/formulaequationinput.html rename to xmodule/capa/templates/formulaequationinput.html diff --git a/common/lib/capa/capa/templates/imageinput.html b/xmodule/capa/templates/imageinput.html similarity index 100% rename from common/lib/capa/capa/templates/imageinput.html rename to xmodule/capa/templates/imageinput.html diff --git a/common/lib/capa/capa/templates/jsinput.html b/xmodule/capa/templates/jsinput.html similarity index 100% rename from common/lib/capa/capa/templates/jsinput.html rename to xmodule/capa/templates/jsinput.html diff --git a/common/lib/capa/capa/templates/mathstring.html b/xmodule/capa/templates/mathstring.html similarity index 100% rename from common/lib/capa/capa/templates/mathstring.html rename to xmodule/capa/templates/mathstring.html diff --git a/common/lib/capa/capa/templates/matlabinput.html b/xmodule/capa/templates/matlabinput.html similarity index 100% rename from common/lib/capa/capa/templates/matlabinput.html rename to xmodule/capa/templates/matlabinput.html diff --git a/common/lib/capa/capa/templates/optioninput.html b/xmodule/capa/templates/optioninput.html similarity index 100% rename from common/lib/capa/capa/templates/optioninput.html rename to xmodule/capa/templates/optioninput.html diff --git a/common/lib/capa/capa/templates/schematicinput.html b/xmodule/capa/templates/schematicinput.html similarity index 92% rename from common/lib/capa/capa/templates/schematicinput.html rename to xmodule/capa/templates/schematicinput.html index c0bf6f14c462..9693e0a36d41 100644 --- a/common/lib/capa/capa/templates/schematicinput.html +++ b/xmodule/capa/templates/schematicinput.html @@ -1,4 +1,4 @@ -<%! from capa.util import remove_markup %> +<%! from xmodule.capa.util import remove_markup %>