Skip to content

Commit 46f8966

Browse files
committed
fix unit tests with linters
1 parent 6d80d4a commit 46f8966

2 files changed

Lines changed: 5 additions & 3 deletions

File tree

src/client/common/installer.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ export function disableLinter(product: Product) {
228228

229229
function isProductInstalled(product: Product): Promise<boolean> {
230230
const prodExec = ProductExecutableAndArgs.get(product);
231-
return execPythonFile(prodExec.executable, prodExec.args.concat(['--version']), vscode.workspace.rootPath, false, undefined, undefined, true)
231+
return execPythonFile(prodExec.executable, prodExec.args.concat(['--version']), vscode.workspace.rootPath, false)
232232
.then(() => {
233233
return true;
234234
}).catch(reason => {
@@ -238,5 +238,5 @@ function isProductInstalled(product: Product): Promise<boolean> {
238238

239239
function uninstallproduct(product: Product): Promise<any> {
240240
const uninstallArgs = ProductUninstallScripts.get(product);
241-
return execPythonFile('python', uninstallArgs, vscode.workspace.rootPath, false, undefined, undefined, true);
241+
return execPythonFile('python', uninstallArgs, vscode.workspace.rootPath, false);
242242
}

src/client/common/utils.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,9 @@ export function getPathFromPythonCommand(args: string[]): Promise<string> {
9696
});
9797
}
9898

99-
export function execPythonFile(file: string, args: string[], cwd: string, includeErrorAsResponse: boolean = false, stdOut: (line: string) => void = null, token?: CancellationToken, execAsModule: boolean = false): Promise<string> {
99+
export function execPythonFile(file: string, args: string[], cwd: string, includeErrorAsResponse: boolean = false, stdOut: (line: string) => void = null, token?: CancellationToken): Promise<string> {
100+
const execAsModule = file.toUpperCase() === 'PYTHON' && args.length > 0 && args[0] === '-m';
101+
100102
// If running the python file, then always revert to execFileInternal
101103
// Cuz python interpreter is always a file and we can and will always run it using child_process.execFile()
102104
if (file === settings.PythonSettings.getInstance().pythonPath) {

0 commit comments

Comments
 (0)