Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Table of Contents

...

  1. Read the documentation: https://github.com/edx/edx-ora2/blob/master/test/acceptance/README.rst/
  2. On your devstack, do the following:

    No Format
    nopaneltrue
    (as edxapp user)
    cd /edx/src/edx-ora2
    source edx-ora2/bin/activate
    export ORA_SANDBOX_URL=https://staff:edx@andy-armstrong.sandbox.edx.org (replace with name of your sandbox)


Debugging Python with PyCharm

The first step is to be able to debug into ORA2 source code when running Studio or LMS:

  1. Click on Run > "Edit Configurations..." (or choose it from the toolbar)
  2. For each configuration that might need ORA 2
    1. Select the configuration in question
    2. Click the "..." icon for the "Path Mappings" property
    3. In the modal that appears, click "+" to add a new mapping
    4. In the new row that appears, specify the local path to your ORA2 source code
    5. Then specify the remote path as: /edx/src/edx-ora2
    6. Hit OK
  3. Hit OK to save all the changes

The next step is to add a new remote interpreter which uses the ORA2 virtual env:

  1. Follow the steps to create a remote interpreter here:
    1. https://github.com/edx/edx-platform/wiki/Setting-up-PyCharm-for-edX-development
  2. Before saving the new interpreter, change the "Python interpreter path" to point to the ORA2 virtual env: /edx/src/edx-ora2/edx-ora2/bin/python
  3. Note that this will have changed the default project interpreter to be your new one, so switch it back to your original

The final step is to add a debug configuration for running ORA2 tests:

  1. The simplest option is to clone an existing configuration, e.g. the one you use for running LMS
  2. Rename the configuration as "ORA Tests"
  3. Make sure that the script path is relative (./manage.py)
  4. Change the "Script Parameters" to "test" (this will run all the tests)
  5. Click on "Environment Variables":
    1. Click on "+" to add a new environment variable
    2. Specify the name as "DJANGO_SETTINGS_MODULE"
    3. Specify the value as "settings.test"
  6. Change the "Python interpreter" to select your new ORA2 remote interpreter
  7. Change the working directory to /edx/src/edx-ora2
  8. Click on "Path Mappings":
    1. Verify that you have a mapping for edx-ora2 (you should have created one in the previous section above)
    2. If not, follow the steps above to add one


Expand
titleDeprecated - Vagrant Instructions

DEPRECATED - Using ORA with vagrant devstack

(Note that some of this is outdated, I'm working on updating it to match the 2.0.0 release)

Initial Setup 

 These are the steps to install ORA2 into your pre-existing devstack image:

  • Clone edx-ora2 into the src directory next to edx-platform folder 

    No Format
    cd src
    git clone https://github.com/edx/edx-ora2
    git clone https://github.com/edx/edx-submissions


  • Install the edx-submissions and ORA2 packages into edx-platform. From devstack do the following (note ORA2 goes first so that we can uninstall its copy of edx-submissions):

    No Format
    sudo su edxapp
    pip uninstall ora2
    pip install -e /edx/src/edx-ora2
    pip uninstall edx-submissions
    pip install -e /edx/src/edx-submissions


To run the ORA scripts for packaging, testing etc, you should do the following:

  • As edxapp user, run the following. 

    No Format
    sudo su edxapp
    cd /edx/src/edx-ora2
    # create a new virtualenv
    virtualenv edx-ora2
    # activate this new virtualenv
    source edx-ora2/bin/activate
    make install


  • You can run the ORA tests as the edxapp user: 

    No Format
    cd /edx/src/edx-ora2
    # activate the ORA2 virtualenv
    source edx-ora2/bin/activate
    make test
    # run just the Python tests
    make test-python
    # debug the Jasmine tests in a browser
    make test-js-debug


  • When you run the lms do not use the full paver devstack lms or studio commands as they will cause pip to install ORA2 and submissions again.

    Code Block
    lms runserver --settings=devstack 0.0.0.0:8000


After you have run all the setup commands above, when you restart your devstack do the following to execute ORA scripts:

No Format
vagrant ssh
sudo su edxapp
cd /edx/src/edx-ora2
source edx-ora2/bin/activate	

# now you can use make commands, such as:
make sass


Debugging JavaScript tests

  • Before starting your devstack, add the following line to the Vagrantfile (next to the other port forwarding lines): 

    No Format
    config.vm.network :forwarded_port, guest: 9876, host: 9876  # ORA2 Karma tests


  • This allows you to open the Karma debug page in your local browser
  • Run: make test-js-debug
  • Open your browser of choice onto this URL:
http://localhost:9876/debug.html
  • The tests will be enumerated as they are run, and failures will be shown with stack traces
  • You can now use the debug tools in the browser to diagnose the failures
  • Note that you can re-run just an individual failing test by clicking on its

...

Debugging Python with PyCharm

The first step is to be able to debug into ORA2 source code when running Studio or LMS:

  1. Click on Run > "Edit Configurations..." (or choose it from the toolbar)
  2. For each configuration that might need ORA 2
    1. Select the configuration in question
    2. Click the "..." icon for the "Path Mappings" property
    3. In the modal that appears, click "+" to add a new mapping
    4. In the new row that appears, specify the local path to your ORA2 source code
    5. Then specify the remote path as: /edx/src/edx-ora2
    6. Hit OK
  3. Hit OK to save all the changes

The next step is to add a new remote interpreter which uses the ORA2 virtual env:

  1. Follow the steps to create a remote interpreter here:
    1. https://github.com/edx/edx-platform/wiki/Setting-up-PyCharm-for-edX-development
  2. Before saving the new interpreter, change the "Python interpreter path" to point to the ORA2 virtual env: /edx/src/edx-ora2/edx-ora2/bin/python
  3. Note that this will have changed the default project interpreter to be your new one, so switch it back to your original

The final step is to add a debug configuration for running ORA2 tests:

...

  • name

...