@@ -51,6 +51,8 @@ export class PythonTestController implements ITestController, IExtensionSingleAc
51
51
52
52
public readonly onRunWithoutConfiguration = this . runWithoutConfigurationEvent . event ;
53
53
54
+ private sendTestDisabledTelemetry = true ;
55
+
54
56
constructor (
55
57
@inject ( IWorkspaceService ) private readonly workspaceService : IWorkspaceService ,
56
58
@inject ( IConfigurationService ) private readonly configSettings : IConfigurationService ,
@@ -137,15 +139,26 @@ export class PythonTestController implements ITestController, IExtensionSingleAc
137
139
private async refreshTestDataInternal ( uri ?: Resource ) : Promise < void > {
138
140
this . refreshingStartedEvent . fire ( ) ;
139
141
if ( uri ) {
140
- traceVerbose ( `Testing: Refreshing test data for ${ uri . fsPath } ` ) ;
141
-
142
142
const settings = this . configSettings . getSettings ( uri ) ;
143
143
if ( settings . testing . pytestEnabled ) {
144
+ traceVerbose ( `Testing: Refreshing test data for ${ uri . fsPath } ` ) ;
145
+
146
+ // Ensure we send test telemetry if it gets disabled again
147
+ this . sendTestDisabledTelemetry = true ;
148
+
144
149
await this . pytest . refreshTestData ( this . testController , uri , this . refreshCancellation . token ) ;
145
150
} else if ( settings . testing . unittestEnabled ) {
151
+ traceVerbose ( `Testing: Refreshing test data for ${ uri . fsPath } ` ) ;
152
+
153
+ // Ensure we send test telemetry if it gets disabled again
154
+ this . sendTestDisabledTelemetry = true ;
155
+
146
156
await this . unittest . refreshTestData ( this . testController , uri , this . refreshCancellation . token ) ;
147
157
} else {
148
- sendTelemetryEvent ( EventName . UNITTEST_DISABLED ) ;
158
+ if ( this . sendTestDisabledTelemetry ) {
159
+ this . sendTestDisabledTelemetry = false ;
160
+ sendTelemetryEvent ( EventName . UNITTEST_DISABLED ) ;
161
+ }
149
162
// If we are here we may have to remove an existing node from the tree
150
163
// This handles the case where user removes test settings. Which should remove the
151
164
// tests for that particular case from the tree view
0 commit comments