Skip to content

Commit

Permalink
v2.2
Browse files Browse the repository at this point in the history
  • Loading branch information
eleanorjboyd committed Dec 9, 2024
1 parent 9533e9d commit 8492542
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 373 deletions.
39 changes: 15 additions & 24 deletions src/client/testing/common/debugLauncher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import { getConfigurationsForWorkspace } from '../../debugger/extension/configur
import { getWorkspaceFolder, getWorkspaceFolders } from '../../common/vscodeApis/workspaceApis';
import { showErrorMessage } from '../../common/vscodeApis/windowApis';
import { createDeferred } from '../../common/utils/async';
import { pythonTestAdapterRewriteEnabled } from '../testController/common/utils';
import { addPathToPythonpath } from './helpers';

@injectable()
Expand Down Expand Up @@ -199,11 +198,10 @@ export class DebugLauncher implements ITestDebugLauncher {
workspaceFolder: WorkspaceFolder,
options: LaunchOptions,
): Promise<LaunchRequestArguments> {
const pythonTestAdapterRewriteExperiment = pythonTestAdapterRewriteEnabled(this.serviceContainer);
const configArgs = debugConfig as LaunchRequestArguments;
const testArgs =
options.testProvider === 'unittest' ? options.args.filter((item) => item !== '--debug') : options.args;
const script = DebugLauncher.getTestLauncherScript(options.testProvider, pythonTestAdapterRewriteExperiment);
const script = DebugLauncher.getTestLauncherScript(options.testProvider);
const args = script(testArgs);
const [program] = args;
configArgs.program = program;
Expand All @@ -229,19 +227,18 @@ export class DebugLauncher implements ITestDebugLauncher {
}
launchArgs.request = 'launch';

if (pythonTestAdapterRewriteExperiment) {
if (options.pytestPort && options.runTestIdsPort) {
launchArgs.env = {
...launchArgs.env,
TEST_RUN_PIPE: options.pytestPort,
RUN_TEST_IDS_PIPE: options.runTestIdsPort,
};
} else {
throw Error(
`Missing value for debug setup, both port and uuid need to be defined. port: "${options.pytestPort}" uuid: "${options.pytestUUID}"`,
);
}
if (options.pytestPort && options.runTestIdsPort) {
launchArgs.env = {
...launchArgs.env,
TEST_RUN_PIPE: options.pytestPort,
RUN_TEST_IDS_PIPE: options.runTestIdsPort,
};
} else {
throw Error(
`Missing value for debug setup, both port and uuid need to be defined. port: "${options.pytestPort}" uuid: "${options.pytestUUID}"`,
);
}

const pluginPath = path.join(EXTENSION_ROOT_DIR, 'python_files');
// check if PYTHONPATH is already set in the environment variables
if (launchArgs.env) {
Expand All @@ -263,19 +260,13 @@ export class DebugLauncher implements ITestDebugLauncher {
return launchArgs;
}

private static getTestLauncherScript(testProvider: TestProvider, pythonTestAdapterRewriteExperiment?: boolean) {
private static getTestLauncherScript(testProvider: TestProvider) {
switch (testProvider) {
case 'unittest': {
if (pythonTestAdapterRewriteExperiment) {
return internalScripts.execution_py_testlauncher; // this is the new way to run unittest execution, debugger
}
return internalScripts.visualstudio_py_testlauncher; // old way unittest execution, debugger
return internalScripts.execution_py_testlauncher; // this is the new way to run unittest execution, debugger
}
case 'pytest': {
if (pythonTestAdapterRewriteExperiment) {
return internalScripts.pytestlauncher; // this is the new way to run pytest execution, debugger
}
return internalScripts.testlauncher; // old way pytest execution, debugger
return internalScripts.pytestlauncher; // this is the new way to run pytest execution, debugger
}
default: {
throw new Error(`Unknown test provider '${testProvider}'`);
Expand Down
43 changes: 0 additions & 43 deletions src/client/testing/testController/common/discoveryHelper.ts

This file was deleted.

20 changes: 0 additions & 20 deletions src/client/testing/testController/common/externalDependencies.ts

This file was deleted.

174 changes: 0 additions & 174 deletions src/client/testing/testController/common/resultsHelper.ts

This file was deleted.

Loading

0 comments on commit 8492542

Please sign in to comment.