Skip to content

Commit 3157000

Browse files
author
Kartik Raj
committed
corrected tooltip
1 parent 064154f commit 3157000

5 files changed

Lines changed: 19 additions & 6 deletions

File tree

src/client/unittests/common/managers/baseTestManager.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import { EventName } from '../../../telemetry/constants';
2424
import { sendTelemetryEvent } from '../../../telemetry/index';
2525
import { TestDiscoverytTelemetry, TestRunTelemetry } from '../../../telemetry/types';
2626
import { IPythonUnitTestMessage, IUnitTestDiagnosticService, WorkspaceTestStatus } from '../../types';
27-
import { copyTestResults } from '../testUtils';
27+
import { copyDesiredTestResults } from '../testUtils';
2828
import { CANCELLATION_REASON, CommandSource, TEST_OUTPUT_CHANNEL } from './../constants';
2929
import {
3030
ITestCollectionStorageService,
@@ -175,7 +175,7 @@ export abstract class BaseTestManager implements ITestManager {
175175
if (clearTestStatus) {
176176
this.resetTestResults();
177177
} else if (existingTests) {
178-
copyTestResults(existingTests, tests);
178+
copyDesiredTestResults(existingTests, tests);
179179
this._testResultsService.updateResults(tests);
180180
}
181181
this.testCollectionStorage.storeTests(wkspace, tests);

src/client/unittests/common/services/testResultsService.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ export class TestResultsService implements ITestResultsService {
3838
let totalTime = 0;
3939
let allFilesPassed = true;
4040
let noFilesRan = true;
41+
testFolder.functionsPassed = testFolder.functionsFailed = testFolder.functionsDidNotRun = 0;
4142

4243
testFolder.testFiles.forEach(fl => {
4344
totalTime += fl.time;
@@ -50,6 +51,7 @@ export class TestResultsService implements ITestResultsService {
5051

5152
testFolder.functionsFailed! += fl.functionsFailed!;
5253
testFolder.functionsPassed! += fl.functionsPassed!;
54+
testFolder.functionsDidNotRun! += fl.functionsDidNotRun!;
5355
});
5456

5557
let allFoldersPassed = true;
@@ -67,6 +69,7 @@ export class TestResultsService implements ITestResultsService {
6769

6870
testFolder.functionsFailed! += folder.functionsFailed!;
6971
testFolder.functionsPassed! += folder.functionsPassed!;
72+
testFolder.functionsDidNotRun! += folder.functionsDidNotRun!;
7073
});
7174

7275
testFolder.time = totalTime;
@@ -82,6 +85,7 @@ export class TestResultsService implements ITestResultsService {
8285
let totalTime = 0;
8386
let allFunctionsPassed = true;
8487
let noFunctionsRan = true;
88+
test.functionsPassed = test.functionsFailed = test.functionsDidNotRun = 0;
8589

8690
test.functions.forEach(fn => {
8791
totalTime += fn.time;
@@ -93,6 +97,8 @@ export class TestResultsService implements ITestResultsService {
9397
test.functionsFailed! += 1;
9498
allFunctionsPassed = false;
9599
}
100+
} else {
101+
test.functionsDidNotRun! += 1;
96102
}
97103
});
98104

@@ -111,6 +117,7 @@ export class TestResultsService implements ITestResultsService {
111117

112118
test.functionsFailed! += suite.functionsFailed!;
113119
test.functionsPassed! += suite.functionsPassed!;
120+
test.functionsDidNotRun! += suite.functionsDidNotRun!;
114121
});
115122

116123
test.time = totalTime;

src/client/unittests/common/testUtils.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,7 @@ export function getChildren(item: TestDataItem): TestDataItem[] {
454454
}
455455
}
456456

457-
export function copyTestResults(source: Tests, target: Tests): void {
457+
export function copyDesiredTestResults(source: Tests, target: Tests): void {
458458
copyResultsForFolders(source.testFolders, target.testFolders);
459459
}
460460

@@ -466,6 +466,8 @@ function copyResultsForFolders(source: TestFolder[], target: TestFolder[]): void
466466
}
467467
copyValueTypes<TestFolder>(sourceFolder, targetFolder);
468468
copyResultsForFiles(sourceFolder.testFiles, targetFolder.testFiles);
469+
// These should be reinitialized
470+
targetFolder.functionsPassed = targetFolder.functionsDidNotRun = targetFolder.functionsFailed = 0;
469471
});
470472
}
471473
function copyResultsForFiles(source: TestFile[], target: TestFile[]): void {
@@ -477,6 +479,8 @@ function copyResultsForFiles(source: TestFile[], target: TestFile[]): void {
477479
copyValueTypes<TestFile>(sourceFile, targetFile);
478480
copyResultsForFunctions(sourceFile.functions, targetFile.functions);
479481
copyResultsForSuites(sourceFile.suites, targetFile.suites);
482+
// These should be reinitialized
483+
targetFile.functionsPassed = targetFile.functionsDidNotRun = targetFile.functionsFailed = 0;
480484
});
481485
}
482486

@@ -501,6 +505,8 @@ function copyResultsForSuites(source: TestSuite[], target: TestSuite[]): void {
501505
copyValueTypes<TestSuite>(sourceSuite, targetSuite);
502506
copyResultsForFunctions(sourceSuite.functions, targetSuite.functions);
503507
copyResultsForSuites(sourceSuite.suites, targetSuite.suites);
508+
// These should be reinitialized
509+
targetSuite.functionsPassed = targetSuite.functionsDidNotRun = targetSuite.functionsFailed = 0;
504510
});
505511
}
506512

src/client/unittests/explorer/testTreeViewItem.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ export class TestTreeItem extends TreeItem {
7272
return '';
7373
}
7474
const result = this.data as TestResult;
75-
if (!result.status || result.status === TestStatus.Idle || result.status === TestStatus.Unknown || result.status === TestStatus.Skipped){
75+
if (!result.status || result.status === TestStatus.Idle || result.status === TestStatus.Unknown || result.status === TestStatus.Skipped) {
7676
return '';
7777
}
7878
if (this.testType !== TestType.testFunction) {

src/test/unittests/common/services/storageService.unit.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
'use strict';
55

66
import * as assert from 'assert';
7-
import { copyTestResults } from '../../../../client/unittests/common/testUtils';
7+
import { copyDesiredTestResults } from '../../../../client/unittests/common/testUtils';
88
import { FlattenedTestFunction, FlattenedTestSuite, TestFile, TestFolder, TestFunction, Tests, TestStatus, TestSuite, TestType } from '../../../../client/unittests/common/types';
99
import { createMockTestDataItem } from '../testUtils.unit.test';
1010

@@ -114,7 +114,7 @@ suite('Unit Tests - Storage Service', () => {
114114
assert.notDeepEqual(testData1.testFunctions[1].testFunction, testData2.testFunctions[1].testFunction);
115115
assert.notDeepEqual(testData1.testFunctions[2].testFunction, testData2.testFunctions[2].testFunction);
116116

117-
copyTestResults(testData1, testData2);
117+
copyDesiredTestResults(testData1, testData2);
118118

119119
// Function 1 is in a different suite now, hence should not get updated.
120120
assert.notDeepEqual(testData1.testFunctions[0].testFunction, testData2.testFunctions[0].testFunction);

0 commit comments

Comments
 (0)