@@ -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 (
@@ -420,11 +423,11 @@ export class PythonTestController implements ITestController, IExtensionSingleAc
420423
421424 const settings = this . configSettings . getSettings ( workspace . uri ) ;
422425 if ( testItems . length > 0 ) {
423- // coverage??
424426 const testAdapter =
425427 this . testAdapters . get ( workspace . uri ) ||
426428 ( this . testAdapters . values ( ) . next ( ) . value as WorkspaceTestAdapter ) ;
427429
430+ // no profile will have TestRunProfileKind.Coverage if rewrite isn't enabled
428431 if ( request . profile ?. kind && request . profile ?. kind === TestRunProfileKind . Coverage ) {
429432 request . profile . loadDetailedCoverage = (
430433 _testRun : TestRun ,
0 commit comments