From d5bd4bc1f23e1e3b1d63e81e7e010e2ec1c0fc8f Mon Sep 17 00:00:00 2001 From: Richin Jain Date: Thu, 18 Jul 2019 11:49:06 -0400 Subject: [PATCH] Addressing PR comments and using markers to invoke AML noebook tests --- ... azure-pipeline-azureml-notebook-test.yml} | 9 ++-- tests/smoke/test_azureml_notebooks.py | 51 +++++++++++-------- 2 files changed, 33 insertions(+), 27 deletions(-) rename .ci/{azureml-notebook-smoketest.yml => azure-pipeline-azureml-notebook-test.yml} (87%) diff --git a/.ci/azureml-notebook-smoketest.yml b/.ci/azure-pipeline-azureml-notebook-test.yml similarity index 87% rename from .ci/azureml-notebook-smoketest.yml rename to .ci/azure-pipeline-azureml-notebook-test.yml index 2a3612e..146bbd5 100644 --- a/.ci/azureml-notebook-smoketest.yml +++ b/.ci/azure-pipeline-azureml-notebook-test.yml @@ -4,9 +4,9 @@ variables: - group: AzureMLConfig - name : 'resource_group' - value : 'smoketest' + value : 'amlnotebookrg' - name : 'workspace_name' - value : 'smoketestws' + value : 'amlnotebookws' - name : 'workspace_region' value : 'eastus2' trigger: none @@ -27,7 +27,6 @@ steps: - bash: | conda env create -f environment.yml pip install paramiko==2.4.2 - pip install azureml-sdk source activate cv conda env list echo Login Azure Account @@ -38,8 +37,8 @@ steps: - bash: | source activate cv python -m ipykernel install --user --name cv --display-name "cv" - pytest -q --subscription_id=$(subscriptionid) --resource_group=$(resource_group) --workspace_name=$(workspace_name) --workspace_region=$(workspace_region) tests/smoke/test_azureml_notebooks.py - displayName: 'Install azureml sdk and run azure ml smoke tests' + pytest -q --subscription_id=$(subscriptionid) --resource_group=$(resource_group) --workspace_name=$(workspace_name) --workspace_region=$(workspace_region) -m azuremlnotebooks + displayName: 'Run AzureML notebook tests' - bash: | diff --git a/tests/smoke/test_azureml_notebooks.py b/tests/smoke/test_azureml_notebooks.py index 111d961..2c482fa 100644 --- a/tests/smoke/test_azureml_notebooks.py +++ b/tests/smoke/test_azureml_notebooks.py @@ -1,29 +1,24 @@ # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. -# This test is based on the test suite implemented for Recommenders project -# https://github.com/Microsoft/Recommenders/tree/master/tests - -import os -import glob import papermill as pm import pytest -import shutil -# Unless manually modified, python3 should be +# Unless manually modified, cv should be # the name of the current jupyter kernel # that runs on the activated conda environment KERNEL_NAME = "cv" OUTPUT_NOTEBOOK = "output.ipynb" -@pytest.mark.azureml_notebook_test + +@pytest.mark.azuremlnotebooks def test_20_notebook_run( classification_notebooks, subscription_id, resource_group, workspace_name, - workspace_region - ): + workspace_region, +): notebook_path = classification_notebooks["20_azure_workspace_setup"] pm.execute_notebook( notebook_path, @@ -33,20 +28,23 @@ def test_20_notebook_run( subscription_id=subscription_id, resource_group=resource_group, workspace_name=workspace_name, - workspace_region=workspace_region + workspace_region=workspace_region, ), kernel_name=KERNEL_NAME, ) -@pytest.mark.azureml_notebook_test +@pytest.mark.azuremlnotebooks def test_21_notebook_run( classification_notebooks, subscription_id, resource_group, workspace_name, - workspace_region): - notebook_path = classification_notebooks["21_deployment_on_azure_container_instances"] + workspace_region, +): + notebook_path = classification_notebooks[ + "21_deployment_on_azure_container_instances" + ] pm.execute_notebook( notebook_path, OUTPUT_NOTEBOOK, @@ -55,18 +53,23 @@ def test_21_notebook_run( subscription_id=subscription_id, resource_group=resource_group, workspace_name=workspace_name, - workspace_region=workspace_region), + workspace_region=workspace_region, + ), kernel_name=KERNEL_NAME, ) -@pytest.mark.azureml_notebook_test + +@pytest.mark.azuremlnotebooks def test_22_notebook_run( classification_notebooks, subscription_id, resource_group, workspace_name, - workspace_region): - notebook_path = classification_notebooks["22_deployment_on_azure_kubernetes_service"] + workspace_region, +): + notebook_path = classification_notebooks[ + "22_deployment_on_azure_kubernetes_service" + ] pm.execute_notebook( notebook_path, OUTPUT_NOTEBOOK, @@ -75,17 +78,20 @@ def test_22_notebook_run( subscription_id=subscription_id, resource_group=resource_group, workspace_name=workspace_name, - workspace_region=workspace_region), + workspace_region=workspace_region, + ), kernel_name=KERNEL_NAME, ) -@pytest.mark.azureml_notebook_test + +@pytest.mark.azuremlnotebooks def test_23_notebook_run( classification_notebooks, subscription_id, resource_group, workspace_name, - workspace_region): + workspace_region, +): notebook_path = classification_notebooks["23_aci_aks_web_service_testing"] pm.execute_notebook( notebook_path, @@ -95,6 +101,7 @@ def test_23_notebook_run( subscription_id=subscription_id, resource_group=resource_group, workspace_name=workspace_name, - workspace_region=workspace_region), + workspace_region=workspace_region, + ), kernel_name=KERNEL_NAME, )