Skip to content

Commit

Permalink
only show coverage button for rewrite (microsoft#24249)
Browse files Browse the repository at this point in the history
  • Loading branch information
eleanorjboyd authored Oct 5, 2024
1 parent 8c4dee4 commit ebe55a4
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions src/client/testing/testController/controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,14 +119,6 @@ export class PythonTestController implements ITestController, IExtensionSingleAc
this.disposables.push(delayTrigger);
this.refreshData = delayTrigger;

const coverageProfile = this.testController.createRunProfile(
'Coverage Tests',
TestRunProfileKind.Coverage,
this.runTests.bind(this),
true,
RunTestTag,
);

this.disposables.push(
this.testController.createRunProfile(
'Run Tests',
Expand All @@ -142,8 +134,19 @@ export class PythonTestController implements ITestController, IExtensionSingleAc
true,
DebugTestTag,
),
coverageProfile,
);
if (pythonTestAdapterRewriteEnabled(this.serviceContainer)) {
// only add the coverage profile if the new test adapter is enabled
const coverageProfile = this.testController.createRunProfile(
'Coverage Tests',
TestRunProfileKind.Coverage,
this.runTests.bind(this),
true,
RunTestTag,
);

this.disposables.push(coverageProfile);
}
this.testController.resolveHandler = this.resolveChildren.bind(this);
this.testController.refreshHandler = (token: CancellationToken) => {
this.disposables.push(
Expand Down Expand Up @@ -420,11 +423,11 @@ export class PythonTestController implements ITestController, IExtensionSingleAc

const settings = this.configSettings.getSettings(workspace.uri);
if (testItems.length > 0) {
// coverage??
const testAdapter =
this.testAdapters.get(workspace.uri) ||
(this.testAdapters.values().next().value as WorkspaceTestAdapter);

// no profile will have TestRunProfileKind.Coverage if rewrite isn't enabled
if (request.profile?.kind && request.profile?.kind === TestRunProfileKind.Coverage) {
request.profile.loadDetailedCoverage = (
_testRun: TestRun,
Expand Down

0 comments on commit ebe55a4

Please sign in to comment.