Skip to content

Commit 0b37929

Browse files
committed
only show coverage button for rewrite
1 parent 8bcf046 commit 0b37929

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

src/client/testing/testController/controller.ts

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -119,14 +119,6 @@ export class PythonTestController implements ITestController, IExtensionSingleAc
119119
this.disposables.push(delayTrigger);
120120
this.refreshData = delayTrigger;
121121

122-
const coverageProfile = this.testController.createRunProfile(
123-
'Coverage Tests',
124-
TestRunProfileKind.Coverage,
125-
this.runTests.bind(this),
126-
true,
127-
RunTestTag,
128-
);
129-
130122
this.disposables.push(
131123
this.testController.createRunProfile(
132124
'Run Tests',
@@ -142,8 +134,19 @@ export class PythonTestController implements ITestController, IExtensionSingleAc
142134
true,
143135
DebugTestTag,
144136
),
145-
coverageProfile,
146137
);
138+
if (pythonTestAdapterRewriteEnabled(this.serviceContainer)) {
139+
// only add the coverage profile if the new test adapter is enabled
140+
const coverageProfile = this.testController.createRunProfile(
141+
'Coverage Tests',
142+
TestRunProfileKind.Coverage,
143+
this.runTests.bind(this),
144+
true,
145+
RunTestTag,
146+
);
147+
148+
this.disposables.push(coverageProfile);
149+
}
147150
this.testController.resolveHandler = this.resolveChildren.bind(this);
148151
this.testController.refreshHandler = (token: CancellationToken) => {
149152
this.disposables.push(
@@ -418,11 +421,11 @@ export class PythonTestController implements ITestController, IExtensionSingleAc
418421

419422
const settings = this.configSettings.getSettings(workspace.uri);
420423
if (testItems.length > 0) {
421-
// coverage??
422424
const testAdapter =
423425
this.testAdapters.get(workspace.uri) ||
424426
(this.testAdapters.values().next().value as WorkspaceTestAdapter);
425427

428+
// no profile will have TestRunProfileKind.Coverage if rewrite isn't enabled
426429
if (request.profile?.kind && request.profile?.kind === TestRunProfileKind.Coverage) {
427430
request.profile.loadDetailedCoverage = (
428431
_testRun: TestRun,

0 commit comments

Comments
 (0)