forked from DonJayamanne/pythonVSCode
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.ts
More file actions
31 lines (30 loc) · 1.54 KB
/
Copy pathmain.ts
File metadata and controls
31 lines (30 loc) · 1.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
'use strict';
import { PythonSettings } from '../../common/configSettings';
import { TestsToRun, Tests, TestStatus } from '../common/contracts';
import { runTest } from './runner';
import * as vscode from 'vscode';
import { discoverTests } from './collector';
import { BaseTestManager } from '../common/baseTestManager';
import { Product } from '../../common/installer';
const settings = PythonSettings.getInstance();
export class TestManager extends BaseTestManager {
constructor(rootDirectory: string, outputChannel: vscode.OutputChannel) {
super('unitest', Product.unittest, rootDirectory, outputChannel);
}
configure() {
}
discoverTestsImpl(ignoreCache: boolean): Promise<Tests> {
let args = settings.unitTest.unittestArgs.slice(0);
return discoverTests(this.rootDirectory, args, this.cancellationToken, ignoreCache, this.outputChannel);
}
runTestImpl(tests: Tests, testsToRun?: TestsToRun, runFailedTests?: boolean, debug?: boolean): Promise<any> {
let args = settings.unitTest.unittestArgs.slice(0);
if (runFailedTests === true) {
testsToRun = { testFile: [], testFolder: [], testSuite: [], testFunction: [] };
testsToRun.testFunction = tests.testFunctions.filter(fn => {
return fn.testFunction.status === TestStatus.Error || fn.testFunction.status === TestStatus.Fail;
}).map(fn => fn.testFunction);
}
return runTest(this, this.rootDirectory, tests, args, testsToRun, this.cancellationToken, this.outputChannel, debug);
}
}