Tired of typing the entire test dotted path to run a single test? Well, now you can do it with single keybind.
If you need to run tests frequently then give it a try
Tired of typing the entire test dotted path to run a single test? Well, now you can do it with single keybind.
If you need to run tests frequently then give it a try
Nice, thanks!
With VSCode open on the bench level (working directory: /Users/raffael/Code/bench/develop
), the dotted path is wrong: it starts with "apps.my-app.my-app"
instead of "my-app"
. (Issue)
Would it be possible to add a command to run a test in the debugger?
Currently this assumes that your workspace root is app’s folder. If you use bench or bench/apps it won’t work
What kind of debugger? pdb/ipdb can be triggered by adding breakpoint()
in test / other code.
I always work in the bench directory, because I implement things across apps, do things on bench level, look at definitions in other apps, etc.
Sorry, I meant the VS Code debugger:
Currently I’m using it with this configuration in .vscode/launch.json
(credits to @scdanieli):
{
"version": "0.3.0",
"configurations": [
{
"name": "bench run-tests --module",
"type": "python",
"request": "launch",
"program": "${workspaceFolder}/apps/frappe/frappe/utils/bench_helper.py",
"args": [
"frappe", "--site", "${input:site}", "run-tests", "--module", "${input:test}"
],
"python": "${workspaceFolder}/env/bin/python",
"cwd": "${workspaceFolder}/sites",
"env": {
"DEV_SERVER": "1"
}
}
],
"inputs": [
{
"type": "pickString",
"id": "site",
"description": "Which site?",
"options": [
"erpnext.local",
"frappe.local"
],
"default": "frappe.local"
},
{
"type": "pickString",
"id": "test",
"description": "Dotted path to test module (file)",
"options": [
"frappe.contacts.doctype.contact.test_contact"
// ...
]
}
]
}
This is slightly more work, because I need to add sites and tests manually once.