Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Icon should be unknown when no tests are run #4710

Merged
merged 3 commits into from
Mar 13, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/client/unittests/explorer/testTreeViewItem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@ export class TestTreeItem extends TreeItem {
return '';
}
const result = this.data as TestResult;
if (!result.status || result.status === TestStatus.Idle || result.status === TestStatus.Unknown || result.status === TestStatus.Skipped){
return '';
}
if (this.testType !== TestType.testFunction) {
return `${result.functionsFailed} failed, ${result.functionsPassed} passed in ${result.time} seconds`;
}
Expand Down
6 changes: 3 additions & 3 deletions src/client/unittests/pytest/services/parserService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ export class TestsParser implements ITestsParser {
const testFile = {
resource: Uri.file(rootDirectory),
functions: [], suites: [], name: fileName, fullPath: fullyQualifiedName,
nameToRun: fileName, xmlName: currentPackage, time: 0, errorsWhenDiscovering: lines.join('\n')
nameToRun: fileName, xmlName: currentPackage, time: 0, functionsPassed: 0, functionsFailed: 0, functionsDidNotRun: 0, errorsWhenDiscovering: lines.join('\n')
};
testFiles.push(testFile);
parentNodes.push({ indent: 0, item: testFile });
Expand Down Expand Up @@ -163,7 +163,7 @@ export class TestsParser implements ITestsParser {
const testFile = {
resource,
functions: [], suites: [], name: name, fullPath: fullyQualifiedName,
nameToRun: name, xmlName: currentPackage, time: 0
nameToRun: name, xmlName: currentPackage, time: 0, functionsPassed: 0, functionsFailed: 0, functionsDidNotRun: 0
};
testFiles.push(testFile);
parentNodes.push({ indent: indent, item: testFile });
Expand All @@ -183,7 +183,7 @@ export class TestsParser implements ITestsParser {

const rawName = `${parentNode!.item.nameToRun}::${name}`;
const xmlName = `${parentNode!.item.xmlName}.${name}`;
const testSuite: TestSuite = { resource, name: name, nameToRun: rawName, functions: [], suites: [], isUnitTest: isUnitTest, isInstance: false, xmlName: xmlName, time: 0 };
const testSuite: TestSuite = { resource, name: name, nameToRun: rawName, functions: [], suites: [], isUnitTest: isUnitTest, isInstance: false, xmlName: xmlName, time: 0, functionsPassed: 0, functionsFailed: 0, functionsDidNotRun: 0 };
parentNode!.item.suites.push(testSuite);
parentNodes.push({ indent: indent, item: testSuite });
return;
Expand Down
14 changes: 14 additions & 0 deletions src/client/unittests/unittest/runner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,20 @@ export class TestManagerRunner implements ITestManagerRunner {
const statusDetails = outcomeMapping.get(data.outcome)!;
if (test) {
test.testFunction.status = statusDetails.status;
switch (test.testFunction.status){
case TestStatus.Error:
case TestStatus.Fail: {
test.testFunction.passed = false;
break;
}
case TestStatus.Pass: {
test.testFunction.passed = true;
break;
}
default: {
test.testFunction.passed = undefined;
}
}
test.testFunction.message = data.message;
test.testFunction.traceback = data.traceback;
options.tests.summary[statusDetails.summaryProperty] += 1;
Expand Down