Skip to content

Commit 89c7e72

Browse files
authored
add "copy test id" to menu (#25475)
fixes #25476
1 parent f3675b0 commit 89c7e72

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

.github/instructions/testing_feature_area.instructions.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,9 +173,15 @@ The adapters in the extension don't implement test discovery/run logic themselve
173173
- Debug adapter/resolver code in the extension's debugger modules may also be used when attaching to Django or test subprocesses.
174174
- Commands and configuration
175175
- The Test Controller wires commands that appear in the Test Explorer and editor context menus (see `package.json` contributes `commands`) and listens to configuration changes filtered by `python.testing` in `src/client/testing/main.ts`.
176+
- The "Copy Test ID" command (`python.copyTestId`) can be accessed from both the Test Explorer context menu (`testing/item/context`) and the editor gutter icon context menu (`testing/item/gutter`). This command copies test identifiers to the clipboard in the appropriate format for the active test framework (pytest path format or unittest module.class.method format).
176177
- Execution factory & activated environments
177178
- Adapters use the extension `ExecutionFactory` to spawn subprocesses in an activated interpreter (so the user's venv/conda is used). This involves the extension's internal environment execution APIs and sometimes `envExt` helpers when the external environment extension is present.
178179

179180
## Learnings
180181

181182
- Never await `showErrorMessage()` calls in test execution adapters as it blocks the test UI thread and freezes the Test Explorer (1)
183+
- VS Code test-related context menus are contributed to using both `testing/item/context` and `testing/item/gutter` menu locations in package.json for full coverage (1)
184+
185+
```
186+
187+
```

package.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1244,6 +1244,13 @@
12441244
"when": "controllerId == 'python-tests'"
12451245
}
12461246
],
1247+
"testing/item/gutter": [
1248+
{
1249+
"command": "python.copyTestId",
1250+
"group": "navigation",
1251+
"when": "controllerId == 'python-tests'"
1252+
}
1253+
],
12471254
"commandPalette": [
12481255
{
12491256
"category": "Python",

0 commit comments

Comments
 (0)