Add python test (#1482)
This commit is contained in:
Родитель
7f031a84fb
Коммит
b9114b181f
10
gulpfile.ts
10
gulpfile.ts
|
@ -22,11 +22,11 @@ import * as request from 'request';
|
|||
import * as requestP from 'request-promise';
|
||||
import * as buffer from 'vinyl-buffer';
|
||||
import * as source from 'vinyl-source-stream';
|
||||
import { gulp_installAzureAccount, gulp_webpack } from 'vscode-azureextensiondev';
|
||||
import { gulp_installAzureAccount, gulp_installVSCodeExtension, gulp_webpack } from 'vscode-azureextensiondev';
|
||||
|
||||
function test() {
|
||||
const env = process.env;
|
||||
env.DEBUGTELEMETRY = '1';
|
||||
env.DEBUGTELEMETRY = 'v';
|
||||
env.MOCHA_timeout = String(20 * 1000);
|
||||
env.CODE_TESTS_WORKSPACE = path.join(__dirname, 'test/test.code-workspace');
|
||||
env.CODE_TESTS_PATH = path.join(__dirname, 'dist/test');
|
||||
|
@ -80,6 +80,10 @@ function installFuncCli() {
|
|||
.pipe(gulp.dest(funcDir));
|
||||
}
|
||||
|
||||
function gulp_installPythonExtension() {
|
||||
return gulp_installVSCodeExtension('2019.8.30787', 'ms-python', 'python');
|
||||
}
|
||||
|
||||
exports['webpack-dev'] = () => gulp_webpack('development');
|
||||
exports['webpack-prod'] = () => gulp_webpack('production');
|
||||
exports.test = gulp.series(gulp_installAzureAccount, getFuncLink, installFuncCli, test);
|
||||
exports.test = gulp.series(gulp_installAzureAccount, gulp_installPythonExtension, getFuncLink, installFuncCli, test);
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
import * as unixPsTree from 'ps-tree';
|
||||
import * as vscode from 'vscode';
|
||||
import { IActionContext, UserCancelledError } from 'vscode-azureextensionui';
|
||||
import { extensionPrefix, funcHostStartCommand, isWindows } from '../constants';
|
||||
import { extensionPrefix, hostStartTaskName, isWindows } from '../constants';
|
||||
import { IPreDebugValidateResult, preDebugValidate } from '../debug/validatePreDebug';
|
||||
import { IRunningFuncTask, isFuncHostTask, runningFuncTaskMap } from '../funcCoreTools/funcHostTask';
|
||||
import { localize } from '../localize';
|
||||
|
@ -30,7 +30,7 @@ export async function pickFuncProcess(context: IActionContext, debugConfig: vsco
|
|||
});
|
||||
|
||||
if (!funcTask) {
|
||||
throw new Error(localize('noFuncTask', 'Failed to find "{0}" task.', preLaunchTaskName || funcHostStartCommand));
|
||||
throw new Error(localize('noFuncTask', 'Failed to find "{0}" task.', preLaunchTaskName || hostStartTaskName));
|
||||
}
|
||||
|
||||
const settingKey: string = 'pickProcessTimeout';
|
||||
|
|
|
@ -76,15 +76,12 @@ export const javaPackageTaskLabel: string = 'package';
|
|||
export const func: string = 'func';
|
||||
export const extInstallCommand: string = 'extensions install';
|
||||
export const extInstallTaskName: string = `${func}: ${extInstallCommand}`;
|
||||
export const funcExtInstallCommand: string = `${func} ${extInstallCommand}`;
|
||||
|
||||
export const hostStartCommand: string = 'host start';
|
||||
export const hostStartTaskName: string = `${func}: ${hostStartCommand}`;
|
||||
export const funcHostStartCommand: string = `${func} ${hostStartCommand}`;
|
||||
|
||||
export const packCommand: string = 'pack';
|
||||
export const packTaskName: string = `${func}: ${packCommand}`;
|
||||
export const funcPackCommand: string = `${func} ${packCommand}`;
|
||||
|
||||
export const funcWatchProblemMatcher: string = '$func-watch';
|
||||
|
||||
|
|
|
@ -7,7 +7,8 @@ import { isNullOrUndefined } from 'util';
|
|||
import { CancellationToken, ShellExecution, Task, TaskProvider, workspace, WorkspaceFolder } from 'vscode';
|
||||
import { callWithTelemetryAndErrorHandling, IActionContext } from 'vscode-azureextensionui';
|
||||
import { tryGetFunctionProjectRoot } from '../commands/createNewProject/verifyIsProject';
|
||||
import { extInstallCommand, func, funcExtInstallCommand, funcWatchProblemMatcher, hostStartCommand, ProjectLanguage, projectLanguageSetting } from '../constants';
|
||||
import { extInstallCommand, func, funcWatchProblemMatcher, hostStartCommand, ProjectLanguage, projectLanguageSetting } from '../constants';
|
||||
import { ext } from '../extensionVariables';
|
||||
import { getWorkspaceSetting } from '../vsCodeConfig/settings';
|
||||
import { FuncDebugProviderBase } from './FuncDebugProviderBase';
|
||||
import { getFuncTaskCommand, IFuncTaskCommand } from './getFuncTaskCommand';
|
||||
|
@ -133,6 +134,6 @@ function getExtensionInstallTask(folder: WorkspaceFolder, projectRoot: string):
|
|||
folder,
|
||||
extInstallCommand,
|
||||
func,
|
||||
new ShellExecution(funcExtInstallCommand, { cwd: projectRoot })
|
||||
new ShellExecution(`${ext.funcCliPath} ${extInstallCommand}`, { cwd: projectRoot })
|
||||
);
|
||||
}
|
||||
|
|
|
@ -4,11 +4,12 @@
|
|||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { ShellExecution, Task, WorkspaceFolder } from 'vscode';
|
||||
import { func, funcPackCommand, packCommand } from '../constants';
|
||||
import { func, packCommand } from '../constants';
|
||||
import { ext } from '../extensionVariables';
|
||||
import { venvUtils } from '../utils/venvUtils';
|
||||
|
||||
export function getPythonTasks(folder: WorkspaceFolder, projectRoot: string): Task[] {
|
||||
const commandLine: string = venvUtils.convertToVenvCommand(funcPackCommand, folder.uri.fsPath);
|
||||
const commandLine: string = venvUtils.convertToVenvCommand(`${ext.funcCliPath} ${packCommand}`, folder.uri.fsPath);
|
||||
const basicPack: Task = new Task(
|
||||
{
|
||||
type: func,
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
|
||||
import { ExtensionContext } from "vscode";
|
||||
import { AzExtTreeDataProvider, IAzExtOutputChannel, IAzureUserInput, ITelemetryReporter } from "vscode-azureextensionui";
|
||||
import { func } from "./constants";
|
||||
import { IBindingTemplate } from "./templates/IBindingTemplate";
|
||||
import { TemplateProvider } from "./templates/TemplateProvider";
|
||||
import { AzureAccountTreeItemWithProjects } from "./tree/AzureAccountTreeItemWithProjects";
|
||||
|
@ -20,7 +21,7 @@ export namespace ext {
|
|||
export let ui: IAzureUserInput;
|
||||
export let templateProviderTask: Promise<TemplateProvider>;
|
||||
export let reporter: ITelemetryReporter;
|
||||
export let funcCliPath: string = 'func';
|
||||
export let funcCliPath: string = func;
|
||||
export let templateSource: TemplateSource | undefined;
|
||||
export let scriptBindings: IBindingTemplate[];
|
||||
// tslint:disable-next-line: strict-boolean-expressions
|
||||
|
|
|
@ -7,9 +7,9 @@ import * as assert from 'assert';
|
|||
import * as fse from 'fs-extra';
|
||||
import { IHookCallbackContext, ISuiteCallbackContext } from 'mocha';
|
||||
import * as vscode from 'vscode';
|
||||
import { delay, getRandomHexString, ProjectLanguage, requestUtils } from '../../extension.bundle';
|
||||
import { delay, getRandomHexString, isWindows, ProjectLanguage, requestUtils } from '../../extension.bundle';
|
||||
import { longRunningTestsEnabled, testUserInput, testWorkspacePath } from '../global.test';
|
||||
import { getCSharpValidateOptions, getJavaScriptValidateOptions, getPowerShellValidateOptions, getTypeScriptValidateOptions, IValidateProjectOptions, validateProject } from '../validateProject';
|
||||
import { getCSharpValidateOptions, getJavaScriptValidateOptions, getPowerShellValidateOptions, getPythonValidateOptions, getTypeScriptValidateOptions, IValidateProjectOptions, validateProject } from '../validateProject';
|
||||
import { resourceGroupsToDelete } from './global.nightly.test';
|
||||
|
||||
suite('Create Project and Deploy', async function (this: ISuiteCallbackContext): Promise<void> {
|
||||
|
@ -27,13 +27,13 @@ suite('Create Project and Deploy', async function (this: ISuiteCallbackContext):
|
|||
});
|
||||
|
||||
test('TypeScript', async () => {
|
||||
const authLevel: string = 'Function';
|
||||
const authLevel: string = 'Anonymous';
|
||||
await testCreateProjectAndDeploy([authLevel], getTypeScriptValidateOptions(), ProjectLanguage.TypeScript);
|
||||
});
|
||||
|
||||
test('CSharp', async () => {
|
||||
const namespace: string = 'Company.Function';
|
||||
const accessRights: string = 'Function';
|
||||
const accessRights: string = 'Admin';
|
||||
await testCreateProjectAndDeploy([namespace, accessRights], getCSharpValidateOptions('testWorkspace', 'netcoreapp2.1'), ProjectLanguage.CSharp);
|
||||
});
|
||||
|
||||
|
@ -42,6 +42,16 @@ suite('Create Project and Deploy', async function (this: ISuiteCallbackContext):
|
|||
await testCreateProjectAndDeploy([authLevel], getPowerShellValidateOptions(), ProjectLanguage.PowerShell);
|
||||
});
|
||||
|
||||
test('Python', async function (this: IHookCallbackContext): Promise<void> {
|
||||
// Disabling on Windows until we can get it to work
|
||||
if (isWindows) {
|
||||
this.skip();
|
||||
}
|
||||
|
||||
const authLevel: string = 'Function';
|
||||
await testCreateProjectAndDeploy([authLevel], getPythonValidateOptions('testWorkspace', '.venv'), ProjectLanguage.Python);
|
||||
});
|
||||
|
||||
async function testCreateProjectAndDeploy(functionInputs: (RegExp | string)[], validateProjectOptions: IValidateProjectOptions, projectLanguage: ProjectLanguage): Promise<void> {
|
||||
const functionName: string = 'func' + getRandomHexString(); // function name must start with a letter
|
||||
await fse.emptyDir(testWorkspacePath);
|
||||
|
|
Загрузка…
Ссылка в новой задаче