Skip to content

Latest commit

 

History

History
79 lines (47 loc) · 2.41 KB

File metadata and controls

79 lines (47 loc) · 2.41 KB

Testing and Debugging

It's possible to debug any of the containers' Python services using PDB. To do so, start up the containers as usual with:

make dev.up

This command starts each relevant container with the equivalent of the '--it' option, allowing a developer to attach to the process once the process is up and running.

To attach to a container and its process, use make dev.attach.<service>. For example:

make dev.attach.lms

Set a PDB breakpoint anywhere in the code using one of the following:

breakpoint()                # Works in Python >= 3.7
import pdb;pdb.set_trace()  # Works in any version of Python

and your attached session will offer an interactive PDB prompt when the breakpoint is hit.

You may be able to detach from the container with the Ctrl-P, Ctrl-Q key sequence. If that doesn't work, you will have either close your terminal window or stop the service with:

make dev.stop.<service>

You can bring that same service back up with:

make dev.up.<service>

After entering a shell for the appropriate service via make lms-shell or make cms-shell, you can run commands from the edx-platform testing documentation Tests can be run individually. Example:

pytest openedx/core/djangoapps/user_api

Tests can also be easily run with a shortcut from the host machine, so that you maintain your command history:

./in lms pytest openedx/core/djangoapps/user_api

If you would like to test modifications to the docker logging configuration as listed in the custom-created public-dockerfiles logging configuration, the docker-production.py file won't exist in devstack due to the local edx-platform copy being mounted as a volume over it.

Any changes will need to be copied over into /py_configuration_files/{lms,cms}.py to be tested on devstack.