Skip to content

Commit 61745de

Browse files
committed
remove unneeded
1 parent aba0183 commit 61745de

File tree

2 files changed

+2
-75
lines changed

2 files changed

+2
-75
lines changed

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

Lines changed: 0 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,8 @@
22
// Licensed under the MIT License.
33

44
import * as crypto from 'crypto';
5-
import { Uri } from 'vscode';
6-
import { ProjectAdapter } from './projectAdapter';
75
import { PythonProject } from '../../../envExt/types';
86

9-
/**
10-
* Separator used between project ID and test path in project-scoped test IDs.
11-
* Using | instead of :: to avoid conflicts with pytest's :: syntax for test paths.
12-
*/
13-
export const PROJECT_ID_SEPARATOR = '|';
14-
157
/**
168
* Generates a unique project ID by hashing the PythonProject object.
179
* This ensures consistent IDs across extension reloads for the same project.
@@ -31,66 +23,6 @@ export function generateProjectId(pythonProject: PythonProject): string {
3123
return `project-${hash.substring(0, 12)}`;
3224
}
3325

34-
/**
35-
* Creates a project-scoped VS Code test item ID.
36-
* Format: "{projectId}|{testPath}"
37-
*
38-
* @param projectId The unique project identifier
39-
* @param testPath The test path (e.g., "/workspace/test.py::test_func")
40-
* @returns The project-scoped VS Code test ID
41-
*/
42-
export function createProjectScopedVsId(projectId: string, testPath: string): string {
43-
return `${projectId}${PROJECT_ID_SEPARATOR}${testPath}`;
44-
}
45-
46-
/**
47-
* Parses a project-scoped VS Code test ID to extract the project ID and test path.
48-
*
49-
* @param vsId The VS Code test item ID
50-
* @returns Object containing projectId and testPath, or null if invalid
51-
*/
52-
export function parseProjectScopedVsId(vsId: string): { projectId: string; testPath: string } | null {
53-
const separatorIndex = vsId.indexOf(PROJECT_ID_SEPARATOR);
54-
if (separatorIndex === -1) {
55-
return null;
56-
}
57-
58-
return {
59-
projectId: vsId.substring(0, separatorIndex),
60-
testPath: vsId.substring(separatorIndex + PROJECT_ID_SEPARATOR.length),
61-
};
62-
}
63-
64-
/**
65-
* Checks if a test file path is within a nested project's directory.
66-
* This is used to determine when to query the API for ownership even if
67-
* only one project discovered the file.
68-
*
69-
* @param testFilePath Absolute path to the test file
70-
* @param allProjects All projects in the workspace
71-
* @param excludeProject Optional project to exclude from the check (typically the discoverer)
72-
* @returns True if the file is within any nested project's directory
73-
*/
74-
export function hasNestedProjectForPath(
75-
testFilePath: string,
76-
allProjects: ProjectAdapter[],
77-
excludeProject?: ProjectAdapter,
78-
): boolean {
79-
return allProjects.some((p) => p !== excludeProject && testFilePath.startsWith(p.projectUri.fsPath));
80-
}
81-
82-
/**
83-
* Finds the project that owns a specific test file based on project URI.
84-
* This is typically used after the API returns ownership information.
85-
*
86-
* @param projectUri The URI of the owning project (from API)
87-
* @param allProjects All projects to search
88-
* @returns The ProjectAdapter with matching URI, or undefined if not found
89-
*/
90-
export function findProjectByUri(projectUri: Uri, allProjects: ProjectAdapter[]): ProjectAdapter | undefined {
91-
return allProjects.find((p) => p.projectUri.fsPath === projectUri.fsPath);
92-
}
93-
9426
/**
9527
* Creates a display name for a project including Python version.
9628
* Format: "{projectName} (Python {version})"

src/client/testing/testController/controller.ts

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,6 @@ export class PythonTestController implements ITestController, IExtensionSingleAc
8585
// @ts-expect-error - used when useProjectBasedTesting=true
8686
private readonly workspaceDiscoveryState: Map<Uri, WorkspaceDiscoveryState> = new Map();
8787

88-
// Flag to enable/disable project-based testing
89-
private useProjectBasedTesting = false;
90-
9188
private readonly triggerTypes: TriggerType[] = [];
9289

9390
private readonly testController: TestController;
@@ -236,8 +233,8 @@ export class PythonTestController implements ITestController, IExtensionSingleAc
236233
public async activate(): Promise<void> {
237234
const workspaces: readonly WorkspaceFolder[] = this.workspaceService.workspaceFolders || [];
238235

239-
// Try to use project-based testing if enabled
240-
if (this.useProjectBasedTesting) {
236+
// Try to use project-based testing if environment extension is enabled
237+
if (useEnvExtension()) {
241238
traceInfo('[test-by-project] Activating project-based testing mode');
242239
try {
243240
await Promise.all(
@@ -283,8 +280,6 @@ export class PythonTestController implements ITestController, IExtensionSingleAc
283280
'[test-by-project] Failed to activate project-based testing, falling back to legacy mode:',
284281
error,
285282
);
286-
traceInfo('[test-by-project] Disabling project-based testing for this session');
287-
this.useProjectBasedTesting = false;
288283
}
289284
}
290285

0 commit comments

Comments
 (0)