From 1bc5154288cf27887508eb4c5aef6faa13d01536 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 8 Jul 2025 15:59:32 +0000 Subject: [PATCH 1/2] Initial plan From b74172bf40c0d9ea98c35671e4d871cf49f4c6b4 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 8 Jul 2025 16:16:27 +0000 Subject: [PATCH 2/2] Fix Python: Configure Tests command not found - add activation event Co-authored-by: eleanorjboyd <26030610+eleanorjboyd@users.noreply.github.com> --- package.json | 1 + .../configureTestsActivation.unit.test.ts | 43 +++++++++++++++++++ 2 files changed, 44 insertions(+) create mode 100644 src/test/testing/configureTestsActivation.unit.test.ts diff --git a/package.json b/package.json index a8a94ada4027..bc9e519e998f 100644 --- a/package.json +++ b/package.json @@ -67,6 +67,7 @@ "onDebugInitialConfigurations", "onLanguage:python", "onDebugResolve:python", + "onCommand:python.configureTests", "onCommand:python.copilotSetupTests", "workspaceContains:mspythonconfig.json", "workspaceContains:pyproject.toml", diff --git a/src/test/testing/configureTestsActivation.unit.test.ts b/src/test/testing/configureTestsActivation.unit.test.ts new file mode 100644 index 000000000000..f52a88943d70 --- /dev/null +++ b/src/test/testing/configureTestsActivation.unit.test.ts @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +'use strict'; + +import { expect } from 'chai'; +import * as path from 'path'; +import * as fs from 'fs'; + +suite('Configure Tests Command Activation', () => { + test('onCommand:python.configureTests should be included in activation events', () => { + // Read package.json from the project root + const packageJsonPath = path.join(__dirname, '..', '..', '..', 'package.json'); + const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8')); + + // Verify that the activation events include the command + const activationEvents = packageJson.activationEvents; + expect(activationEvents).to.include('onCommand:python.configureTests'); + }); + + test('python.configureTests command should be declared in contributes.commands', () => { + // Read package.json from the project root + const packageJsonPath = path.join(__dirname, '..', '..', '..', 'package.json'); + const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8')); + + // Verify that the command is declared in contributes.commands + const commands = packageJson.contributes.commands; + const configureTestsCommand = commands.find((cmd: any) => cmd.command === 'python.configureTests'); + expect(configureTestsCommand).to.not.be.undefined; + expect(configureTestsCommand.category).to.equal('Python'); + }); + + test('Both configureTests and copilotSetupTests commands should have activation events', () => { + // Read package.json from the project root + const packageJsonPath = path.join(__dirname, '..', '..', '..', 'package.json'); + const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8')); + + // Verify both test-related commands have activation events + const activationEvents = packageJson.activationEvents; + expect(activationEvents).to.include('onCommand:python.configureTests'); + expect(activationEvents).to.include('onCommand:python.copilotSetupTests'); + }); +}); \ No newline at end of file