Skip to content

Commit b74172b

Browse files
Copiloteleanorjboyd
andcommitted
Fix Python: Configure Tests command not found - add activation event
Co-authored-by: eleanorjboyd <[email protected]>
1 parent 1bc5154 commit b74172b

File tree

2 files changed

+44
-0
lines changed

2 files changed

+44
-0
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@
6767
"onDebugInitialConfigurations",
6868
"onLanguage:python",
6969
"onDebugResolve:python",
70+
"onCommand:python.configureTests",
7071
"onCommand:python.copilotSetupTests",
7172
"workspaceContains:mspythonconfig.json",
7273
"workspaceContains:pyproject.toml",
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
2+
// Licensed under the MIT License.
3+
4+
'use strict';
5+
6+
import { expect } from 'chai';
7+
import * as path from 'path';
8+
import * as fs from 'fs';
9+
10+
suite('Configure Tests Command Activation', () => {
11+
test('onCommand:python.configureTests should be included in activation events', () => {
12+
// Read package.json from the project root
13+
const packageJsonPath = path.join(__dirname, '..', '..', '..', 'package.json');
14+
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));
15+
16+
// Verify that the activation events include the command
17+
const activationEvents = packageJson.activationEvents;
18+
expect(activationEvents).to.include('onCommand:python.configureTests');
19+
});
20+
21+
test('python.configureTests command should be declared in contributes.commands', () => {
22+
// Read package.json from the project root
23+
const packageJsonPath = path.join(__dirname, '..', '..', '..', 'package.json');
24+
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));
25+
26+
// Verify that the command is declared in contributes.commands
27+
const commands = packageJson.contributes.commands;
28+
const configureTestsCommand = commands.find((cmd: any) => cmd.command === 'python.configureTests');
29+
expect(configureTestsCommand).to.not.be.undefined;
30+
expect(configureTestsCommand.category).to.equal('Python');
31+
});
32+
33+
test('Both configureTests and copilotSetupTests commands should have activation events', () => {
34+
// Read package.json from the project root
35+
const packageJsonPath = path.join(__dirname, '..', '..', '..', 'package.json');
36+
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));
37+
38+
// Verify both test-related commands have activation events
39+
const activationEvents = packageJson.activationEvents;
40+
expect(activationEvents).to.include('onCommand:python.configureTests');
41+
expect(activationEvents).to.include('onCommand:python.copilotSetupTests');
42+
});
43+
});

0 commit comments

Comments
 (0)