Warning
This document is for an old release of Galaxy. You can alternatively view this page in the latest release if it exists or view the top of the latest release's documentation.
Debugging Galaxy Tests¶
Debugging Galaxy unit & integration tests in VS code¶
The following instructions assume that you have cloned your Galaxy fork into ~/galaxy directory.
Start VS Code
Install the Python extension for VS Code: select Extensions on Activity Bar, on the far left-hand side
Create a VS Code workspace by selecting ‘File -> Add Folder to Workspace…’ from menu and adding the
~/galaxy
directoryOptionally, save the workspace by selecting ‘File -> Save Workspace As…’ and save as ‘galaxy.code-workspace’ in the
~/galaxy
directoryAdd the following snippet to
~/galaxy/.vscode/settings.json
(create the file if it does not already exist){ "python.testing.unittestEnabled": false, "python.testing.nosetestsEnabled": false, "python.testing.pytestEnabled": true, "python.testing.pytestArgs": [ "test/", "--ignore=test/shed_functional/", "--ignore=test/functional", "--ignore=test/unit/shed_unit/test_shed_index.py", "packages/test_api/" ], "python.pythonPath": ".venv/bin/python3", "pythonTestExplorer.testFramework": "pytest", }
Re-start VS Code
Choose the .venv Python as your Python Interpreter. First
Ctrl+Shift+P
then>Python: Select Interpreter
. +Select Test on Activity Bar, on the far left hand side. You should see unit and integration tests under ‘Python’ (as shown in the image below). It may take a few seconds for the tests to load up. If they do not, click the ‘Discover Tests’ icon and wait for the tests to load.
Expand integration/unit tests, select a test to display its source code in editor, add a breakpoint, and start the debugger by clicking on the debug icon (next to test name)
Enjoy your debugging session :-)