Skip to content

Commit

Permalink
Revert "Revert "refactor: move common/lib/capa/capa to xmodule/capa" (o…
Browse files Browse the repository at this point in the history
…penedx#30762)"

This reverts commit 4463ee7.
  • Loading branch information
iamsobanjaved authored Jul 27, 2022
1 parent 6d80bdd commit d053bba
Show file tree
Hide file tree
Showing 121 changed files with 144 additions and 182 deletions.
1 change: 0 additions & 1 deletion .coveragerc
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ data_file = reports/${TEST_SUITE}.coverage
source =
cms
common/djangoapps
common/lib/capa
lms
openedx
pavelib
Expand Down
1 change: 0 additions & 1 deletion .coveragerc-local
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ data_file = reports/.coverage
source =
cms
common/djangoapps
common/lib/capa
common/lib/xmodule
lms
openedx
Expand Down
8 changes: 4 additions & 4 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 0 additions & 6 deletions .github/workflows/unit-test-shards.json
Original file line number Diff line number Diff line change
Expand Up @@ -261,12 +261,6 @@
]
},
"common-2": {
"settings": "lms.envs.test",
"paths": [
"common/lib/"
]
},
"common-3": {
"settings": "cms.envs.test",
"paths": [
"common/djangoapps/"
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ jobs:
"cms-2",
"common-1",
"common-2",
"common-3",
"xmodule-1"
]

Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/verify-gha-unit-tests-count.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 2 additions & 2 deletions cms/envs/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 0 additions & 14 deletions common/lib/capa/setup.py

This file was deleted.

4 changes: 2 additions & 2 deletions conf/locale/babel_mako.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
2 changes: 0 additions & 2 deletions docs/guides/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -221,7 +220,6 @@
# the generated *.rst files
modules = {
'cms': 'cms',
'common/lib/capa/capa': 'common/lib/capa',
'lms': 'lms',
'openedx': 'openedx',
'xmodule': 'xmodule',
Expand Down
2 changes: 0 additions & 2 deletions docs/guides/docstrings/common_lib.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,3 @@ out from edx-platform into separate packages at some point.

.. toctree::
:maxdepth: 2

common/lib/capa/modules
4 changes: 2 additions & 2 deletions docs/guides/testing/testing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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/
Expand Down
3 changes: 1 addition & 2 deletions lms/djangoapps/ccx/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lms/djangoapps/courseware/module_render.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down
3 changes: 1 addition & 2 deletions lms/djangoapps/courseware/tests/test_entrance_exam.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lms/djangoapps/courseware/tests/test_masquerade.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions lms/djangoapps/courseware/tests/test_module_render.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions lms/djangoapps/courseware/tests/test_submitting_problems.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions lms/djangoapps/courseware/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions lms/djangoapps/grades/tests/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lms/djangoapps/grades/tests/integration/test_access.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lms/djangoapps/grades/tests/integration/test_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions lms/djangoapps/grades/tests/integration/test_problems.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lms/djangoapps/instructor/tests/test_enrollment.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lms/djangoapps/instructor/tests/test_spoc_gradebook.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lms/djangoapps/instructor_task/tests/test_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
Loading

0 comments on commit d053bba

Please sign in to comment.