Skip to content

Commit 6c78788

Browse files
committed
v2.4
1 parent e220045 commit 6c78788

File tree

8 files changed

+30
-370
lines changed

8 files changed

+30
-370
lines changed

src/client/testing/common/socketServer.ts

Lines changed: 0 additions & 135 deletions
This file was deleted.

src/client/testing/common/types.ts

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { CancellationToken, DebugSessionOptions, Disposable, OutputChannel, Uri } from 'vscode';
1+
import { CancellationToken, DebugSessionOptions, OutputChannel, Uri } from 'vscode';
22
import { Product } from '../../common/types';
33
import { TestSettingsPropertyNames } from '../configuration/types';
44
import { TestProvider } from '../types';
@@ -17,7 +17,6 @@ export type TestDiscoveryOptions = {
1717
outChannel?: OutputChannel;
1818
};
1919

20-
export type UnitTestParserOptions = TestDiscoveryOptions & { startDirectory: string };
2120

2221
export type LaunchOptions = {
2322
cwd: string;
@@ -30,15 +29,6 @@ export type LaunchOptions = {
3029
runTestIdsPort?: string;
3130
};
3231

33-
export type ParserOptions = TestDiscoveryOptions;
34-
35-
export type Options = {
36-
workspaceFolder: Uri;
37-
cwd: string;
38-
args: string[];
39-
outChannel?: OutputChannel;
40-
token?: CancellationToken;
41-
};
4232

4333
export enum TestFilter {
4434
removeTests = 'removeTests',
@@ -91,12 +81,3 @@ export const ITestDebugLauncher = Symbol('ITestDebugLauncher');
9181
export interface ITestDebugLauncher {
9282
launchDebugger(options: LaunchOptions, callback?: () => void, sessionOptions?: DebugSessionOptions): Promise<void>;
9383
}
94-
95-
export const IUnitTestSocketServer = Symbol('IUnitTestSocketServer');
96-
export interface IUnitTestSocketServer extends Disposable {
97-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
98-
on(event: string | symbol, listener: (...args: any[]) => void): this;
99-
removeAllListeners(event?: string | symbol): this;
100-
start(options?: { port?: number; host?: string }): Promise<number>;
101-
stop(): void;
102-
}

src/client/testing/serviceRegistry.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,17 @@ import {
1212
ITestConfigurationService,
1313
ITestDebugLauncher,
1414
ITestsHelper,
15-
IUnitTestSocketServer,
1615
} from './common/types';
1716
import { UnitTestConfigurationService } from './configuration';
1817
import { TestConfigurationManagerFactory } from './configurationFactory';
1918
import { TestingService, UnitTestManagementService } from './main';
2019
import { ITestingService } from './types';
21-
import { UnitTestSocketServer } from './common/socketServer';
2220
import { registerTestControllerTypes } from './testController/serviceRegistry';
2321

2422
export function registerTypes(serviceManager: IServiceManager) {
2523
serviceManager.addSingleton<ITestDebugLauncher>(ITestDebugLauncher, DebugLauncher);
2624

2725
serviceManager.add<ITestsHelper>(ITestsHelper, TestsHelper);
28-
serviceManager.add<IUnitTestSocketServer>(IUnitTestSocketServer, UnitTestSocketServer);
2926

3027
serviceManager.addSingleton<ITestConfigurationService>(ITestConfigurationService, UnitTestConfigurationService);
3128
serviceManager.addSingleton<ITestingService>(ITestingService, TestingService);

src/client/testing/testController/common/types.ts

Lines changed: 27 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,8 @@ import {
1515
} from 'vscode';
1616
import { ITestDebugLauncher } from '../../common/types';
1717
import { IPythonExecutionFactory } from '../../../common/process/types';
18-
import { EnvironmentVariables } from '../../../common/variables/types';
1918
import { PythonEnvironment } from '../../../pythonEnvironments/info';
2019

21-
export type TestRunInstanceOptions = TestRunOptions & {
22-
exclude?: readonly TestItem[];
23-
debug: boolean;
24-
};
25-
2620
export enum TestDataKinds {
2721
Workspace,
2822
FolderOrFile,
@@ -50,13 +44,6 @@ export interface ITestController {
5044
onRunWithoutConfiguration: Event<WorkspaceFolder[]>;
5145
}
5246

53-
export interface ITestRun {
54-
includes: readonly TestItem[];
55-
excludes: readonly TestItem[];
56-
runKind: TestRunProfileKind;
57-
runInstance: TestRun;
58-
}
59-
6047
export const ITestFrameworkController = Symbol('ITestFrameworkController');
6148
export interface ITestFrameworkController {
6249
resolveChildren(testController: TestController, item: TestItem, token?: CancellationToken): Promise<void>;
@@ -65,12 +52,7 @@ export interface ITestFrameworkController {
6552
export const ITestsRunner = Symbol('ITestsRunner');
6653
export interface ITestsRunner {}
6754

68-
export type TestRunOptions = {
69-
workspaceFolder: Uri;
70-
cwd: string;
71-
args: string[];
72-
token: CancellationToken;
73-
};
55+
7456

7557
// We expose these here as a convenience and to cut down on churn
7658
// elsewhere in the code.
@@ -136,43 +118,33 @@ export type TestCommandOptions = {
136118
testIds?: string[];
137119
};
138120

139-
export type TestCommandOptionsPytest = {
140-
workspaceFolder: Uri;
141-
cwd: string;
142-
commandStr: string;
143-
token?: CancellationToken;
144-
outChannel?: OutputChannel;
145-
debugBool?: boolean;
146-
testIds?: string[];
147-
env: { [key: string]: string | undefined };
148-
};
149121

150-
/**
151-
* Interface describing the server that will send test commands to the Python side, and process responses.
152-
*
153-
* Consumers will call sendCommand in order to execute Python-related code,
154-
* and will subscribe to the onDataReceived event to wait for the results.
155-
*/
156-
export interface ITestServer {
157-
readonly onDataReceived: Event<DataReceivedEvent>;
158-
readonly onRunDataReceived: Event<DataReceivedEvent>;
159-
readonly onDiscoveryDataReceived: Event<DataReceivedEvent>;
160-
sendCommand(
161-
options: TestCommandOptions,
162-
env: EnvironmentVariables,
163-
runTestIdsPort?: string,
164-
runInstance?: TestRun,
165-
testIds?: string[],
166-
callback?: () => void,
167-
executionFactory?: IPythonExecutionFactory,
168-
): Promise<void>;
169-
serverReady(): Promise<void>;
170-
getPort(): number;
171-
createUUID(cwd: string): string;
172-
deleteUUID(uuid: string): void;
173-
triggerRunDataReceivedEvent(data: DataReceivedEvent): void;
174-
triggerDiscoveryDataReceivedEvent(data: DataReceivedEvent): void;
175-
}
122+
// /**
123+
// * Interface describing the server that will send test commands to the Python side, and process responses.
124+
// *
125+
// * Consumers will call sendCommand in order to execute Python-related code,
126+
// * and will subscribe to the onDataReceived event to wait for the results.
127+
// */
128+
// export interface ITestServer {
129+
// readonly onDataReceived: Event<DataReceivedEvent>;
130+
// readonly onRunDataReceived: Event<DataReceivedEvent>;
131+
// readonly onDiscoveryDataReceived: Event<DataReceivedEvent>;
132+
// sendCommand(
133+
// options: TestCommandOptions,
134+
// env: EnvironmentVariables,
135+
// runTestIdsPort?: string,
136+
// runInstance?: TestRun,
137+
// testIds?: string[],
138+
// callback?: () => void,
139+
// executionFactory?: IPythonExecutionFactory,
140+
// ): Promise<void>;
141+
// serverReady(): Promise<void>;
142+
// getPort(): number;
143+
// createUUID(cwd: string): string;
144+
// deleteUUID(uuid: string): void;
145+
// triggerRunDataReceivedEvent(data: DataReceivedEvent): void;
146+
// triggerDiscoveryDataReceivedEvent(data: DataReceivedEvent): void;
147+
// }
176148
export interface ITestResultResolver {
177149
runIdToVSid: Map<string, string>;
178150
runIdToTestItem: Map<string, TestItem>;

src/client/testing/testController/pytest/arguments.ts

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Copyright (c) Microsoft Corporation. All rights reserved.
22
// Licensed under the MIT License.
33

4-
import { TestDiscoveryOptions, TestFilter } from '../../common/types';
4+
import { TestFilter } from '../../common/types';
55
import { getPositionalArguments, filterArguments } from '../common/argumentsHelper';
66

77
const OptionsWithArguments = [
@@ -134,11 +134,6 @@ const OptionsWithoutArguments = [
134134
'-d',
135135
];
136136

137-
export function pytestGetTestFilesAndFolders(args: string[]): string[] {
138-
// If users enter test modules/methods, then its not supported.
139-
return getPositionalArguments(args, OptionsWithArguments, OptionsWithoutArguments);
140-
}
141-
142137
export function removePositionalFoldersAndFiles(args: string[]): string[] {
143138
return pytestFilterArguments(args, TestFilter.removeTests);
144139
}
@@ -259,19 +254,3 @@ function pytestFilterArguments(args: string[], argumentToRemoveOrFilter: string[
259254
return filterArguments(filteredArgs, optionsWithArgsToRemove, optionsWithoutArgsToRemove);
260255
}
261256

262-
export function preparePytestArgumentsForDiscovery(options: TestDiscoveryOptions): string[] {
263-
// Remove unwanted arguments (which happen to be test directories & test specific args).
264-
const args = pytestFilterArguments(options.args, TestFilter.discovery);
265-
if (options.ignoreCache && args.indexOf('--cache-clear') === -1) {
266-
args.splice(0, 0, '--cache-clear');
267-
}
268-
if (args.indexOf('-s') === -1) {
269-
args.splice(0, 0, '-s');
270-
}
271-
272-
// Only add --rootdir if user has not already provided one
273-
if (args.filter((a) => a.startsWith('--rootdir')).length === 0) {
274-
args.splice(0, 0, '--rootdir', options.cwd);
275-
}
276-
return args;
277-
}

0 commit comments

Comments
 (0)