Browse Source

(vscode) add launch.json configuration for pytest (#41841)

This configuration will run pytest on the current file using vscode,
allowing the debugger to be used.
To use, ensure the file you want to run tests against is currently
opened,
navigate to run and debug, then select `pytest - current file`

![image](https://user-images.githubusercontent.com/44422760/204608087-11838fb2-374b-44a9-b065-1ce7bec0d1c7.png)

Current limitations
- You have to run the whole file (or you can manually change the args
property, but be sure to revert this before pushing, for example
      `"args": ["${file}::TestClass::test_name"]`)
Dominik Buszowiecki 2 years ago
parent
commit
30df24a771
1 changed files with 8 additions and 0 deletions
  1. 8 0
      .vscode/launch.json

+ 8 - 0
.vscode/launch.json

@@ -37,6 +37,14 @@
       "program": "${workspaceFolder}/node_modules/.bin/jest",
       "internalConsoleOptions": "openOnSessionStart",
       "args": ["--runInBand"]
+    },
+    {
+      "name": "pytest - current file",
+      "type": "python",
+      "request": "launch",
+      "module": "pytest",
+      "args": ["${file}"],
+      "django": true
     }
   ]
 }