Skip to content

Commit 3e5a013

Browse files
committed
bug fix - run specific test
1 parent 3bc37ec commit 3e5a013

1 file changed

Lines changed: 13 additions & 9 deletions

File tree

src/client/unittests/pytest/runner.ts

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
/// <reference path="../../../../typings/globals/xml2js/index.d.ts" />
22

33
'use strict';
4-
import {createDeferred, createTemporaryFile} from '../../common/helpers';
5-
import {TestFile, TestsToRun, TestSuite, TestFunction, FlattenedTestFunction, Tests, TestStatus, FlattenedTestSuite} from '../common/contracts';
6-
import {extractBetweenDelimiters, flattenTestFiles, updateResults, convertFileToPackage} from '../common/testUtils';
7-
import {BaseTestManager} from '../common/baseTestManager';
8-
import {CancellationToken, OutputChannel} from 'vscode';
9-
import {updateResultsFromXmlLogFile, PassCalculationFormulae} from '../common/xUnitParser';
10-
import {run} from '../common/runner';
11-
import {PythonSettings} from '../../common/configSettings';
4+
import { createDeferred, createTemporaryFile } from '../../common/helpers';
5+
import { TestFile, TestsToRun, TestSuite, TestFunction, FlattenedTestFunction, Tests, TestStatus, FlattenedTestSuite } from '../common/contracts';
6+
import { extractBetweenDelimiters, flattenTestFiles, updateResults, convertFileToPackage } from '../common/testUtils';
7+
import { BaseTestManager } from '../common/baseTestManager';
8+
import { CancellationToken, OutputChannel } from 'vscode';
9+
import { updateResultsFromXmlLogFile, PassCalculationFormulae } from '../common/xUnitParser';
10+
import { run } from '../common/runner';
11+
import { PythonSettings } from '../../common/configSettings';
1212

1313
const pythonSettings = PythonSettings.getInstance();
1414

@@ -33,7 +33,11 @@ export function runTest(rootDirectory: string, tests: Tests, args: string[], tes
3333
return createTemporaryFile('.xml').then(xmlLogResult => {
3434
xmlLogFile = xmlLogResult.filePath;
3535
xmlLogFileCleanup = xmlLogResult.cleanupCallback;
36-
const testArgs = args.concat([`--junitxml=${xmlLogFile}`]).concat(testPaths);
36+
if (testPaths.length > 0){
37+
// Ignore the test directories, as we're running a specific test
38+
args = args.filter(arg => arg.trim().startsWith('-'));
39+
}
40+
const testArgs = testPaths.concat(args, [`--junitxml=${xmlLogFile}`]);
3741
return run(pythonSettings.unitTest.pyTestPath, testArgs, rootDirectory, token, outChannel);
3842
}).then(() => {
3943
return updateResultsFromLogFiles(tests, xmlLogFile);

0 commit comments

Comments
 (0)