Skip to content

Commit b916981

Browse files
authored
remove unneeded multiroot code (#21295)
removed extra steps to wrap data since this creates duplicate folders in the controller and only keeps the most recent instead of all the roots from different workspaces.
1 parent e2a9cec commit b916981

File tree

2 files changed

+2
-46
lines changed

2 files changed

+2
-46
lines changed

src/client/testing/testController/controller.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -254,8 +254,6 @@ export class PythonTestController implements ITestController, IExtensionSingleAc
254254
testAdapter.discoverTests(
255255
this.testController,
256256
this.refreshCancellation.token,
257-
this.testAdapters.size > 1,
258-
this.workspaceService.workspaceFile?.fsPath,
259257
this.pythonExecFactory,
260258
);
261259
} else {
@@ -274,8 +272,7 @@ export class PythonTestController implements ITestController, IExtensionSingleAc
274272
testAdapter.discoverTests(
275273
this.testController,
276274
this.refreshCancellation.token,
277-
this.testAdapters.size > 1,
278-
this.workspaceService.workspaceFile?.fsPath,
275+
this.pythonExecFactory,
279276
);
280277
} else {
281278
// else use OLD test discovery mechanism

src/client/testing/testController/workspaceTestAdapter.ts

Lines changed: 1 addition & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,7 @@ import {
2929
getTestCaseNodes,
3030
RunTestTag,
3131
} from './common/testItemUtilities';
32-
import {
33-
DiscoveredTestItem,
34-
DiscoveredTestNode,
35-
DiscoveredTestType,
36-
ITestDiscoveryAdapter,
37-
ITestExecutionAdapter,
38-
} from './common/types';
32+
import { DiscoveredTestItem, DiscoveredTestNode, ITestDiscoveryAdapter, ITestExecutionAdapter } from './common/types';
3933
import { fixLogLines } from './common/utils';
4034
import { IPythonExecutionFactory } from '../../common/process/types';
4135
import { ITestDebugLauncher } from '../common/types';
@@ -288,8 +282,6 @@ export class WorkspaceTestAdapter {
288282
public async discoverTests(
289283
testController: TestController,
290284
token?: CancellationToken,
291-
isMultiroot?: boolean,
292-
workspaceFilePath?: string,
293285
executionFactory?: IPythonExecutionFactory,
294286
): Promise<void> {
295287
sendTelemetryEvent(EventName.UNITTEST_DISCOVERING, undefined, { tool: this.testProvider });
@@ -366,39 +358,6 @@ export class WorkspaceTestAdapter {
366358
// then parse and insert test data.
367359
testController.items.delete(`DiscoveryError:${workspacePath}`);
368360

369-
// Wrap the data under a root node named after the test provider.
370-
const wrappedTests = rawTestData.tests;
371-
372-
// If we are in a multiroot workspace scenario, wrap the current folder's test result in a tree under the overall root + the current folder name.
373-
let rootPath = workspacePath;
374-
let childrenRootPath = rootPath;
375-
let childrenRootName = path.basename(rootPath);
376-
377-
if (isMultiroot) {
378-
rootPath = workspaceFilePath!;
379-
childrenRootPath = workspacePath;
380-
childrenRootName = path.basename(workspacePath);
381-
}
382-
383-
const children = [
384-
{
385-
path: childrenRootPath,
386-
name: childrenRootName,
387-
type_: 'folder' as DiscoveredTestType,
388-
id_: childrenRootPath,
389-
children: wrappedTests ? [wrappedTests] : [],
390-
},
391-
];
392-
393-
// Update the raw test data with the wrapped data.
394-
rawTestData.tests = {
395-
path: rootPath,
396-
name: this.testProvider,
397-
type_: 'folder',
398-
id_: rootPath,
399-
children,
400-
};
401-
402361
if (rawTestData.tests) {
403362
// If the test root for this folder exists: Workspace refresh, update its children.
404363
// Otherwise, it is a freshly discovered workspace, and we need to create a new test root and populate the test tree.

0 commit comments

Comments
 (0)