Repository navigation
Expand file tree
/
Copy pathmain.ts
More file actions
29 lines (27 loc) · 1.36 KB
/
Copy pathmain.ts
File metadata and controls
29 lines (27 loc) · 1.36 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
'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';
const settings = PythonSettings.getInstance();
export class TestManager extends BaseTestManager {
constructor(rootDirectory: string, outputChannel: vscode.OutputChannel) {
super('pytest', rootDirectory, outputChannel);
}
discoverTestsImpl(): Promise<Tests> {
let args = settings.unitTest.unittestArgs.slice(0);
return discoverTests(this.rootDirectory, args, this.cancellationToken);
}
runTestImpl(tests: Tests, testsToRun?: TestsToRun, runFailedTests?: 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.rootDirectory, tests, args, testsToRun, this.cancellationToken, this.outputChannel);
}
}