Skip to content

Commit 5824f51

Browse files
15681 - Omit unittest.TestCase from test explorer discovered nodes (microsoft#15685)
* 15681 - Omit unittest.TestCase from test explorer discovered nodes * 15681 Added missed news file * 15681 Better fix to omit any suites with no tests * Update news/2 Fixes/15681.md Co-authored-by: Karthik Nadig <kanadig@microsoft.com> Co-authored-by: Karthik Nadig <kanadig@microsoft.com>
1 parent 28148f0 commit 5824f51

File tree

4 files changed

+637
-3
lines changed

4 files changed

+637
-3
lines changed

news/2 Fixes/15681.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Stop `unittest.TestCase` appearing as a test suite in the test explorer tree.
2+
(thanks [Bob](https://github.com/bobwalker99).

src/client/testing/nosetest/services/parserService.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,10 @@ export class TestsParser implements ITestsParser {
2626
public parse(content: string, options: ParserOptions): Tests {
2727
let testFiles = this.getTestFiles(content, options);
2828
// Exclude tests that don't have any functions or test suites.
29-
testFiles = testFiles.filter((testFile) => testFile.suites.length > 0 || testFile.functions.length > 0);
29+
testFiles = testFiles.filter((testFile) => {
30+
testFile.suites = testFile.suites.filter((suite) => suite.functions.length > 0);
31+
return testFile.suites.length > 0 || testFile.functions.length > 0;
32+
});
3033
return this.testsHelper.flattenTestFiles(testFiles, options.cwd);
3134
}
3235

0 commit comments

Comments
 (0)