コード例 #1
0
ファイル: test.py プロジェクト: lucky-sideburn/azure-cli
def run_module_tests():
    print("Running tests on command modules.")

    tasks = [TestTask(name, path) for name, path in get_all_command_modules()]
    wait_all_tasks(tasks)

    print()
    print("Summary")
    print("========================")
    summary_format = get_print_template(tasks)
    for t in tasks:
        t.print_format(summary_format)

    print("========================")
    print("* Full debug log available at '{}'.".format(TestTask.LOG_DIR))

    if any(
        [task.name for task in tasks
         if task.rtcode != 0 and not task.skipped]):
        sys.exit(1)
コード例 #2
0
ファイル: test.py プロジェクト: rickrain/azure-cli
def run_module_tests(skip_list=None):
    print("Running tests on command modules.")

    all_modules = [TestModule(name, path) for name, path in get_all_command_modules()]
    if skip_list is not None:
        all_modules = [desc for desc in all_modules if not desc.name in skip_list]

    skipped_modules = [m.name for m in all_modules if not m.exists()]

    tasks = [Task(m.get_task_description()) for m in all_modules if m.exists()]

    Task.wait_all_tasks(tasks)

    print_records(
        [t.get_summary() for t in tasks],
        title="Test Results",
        foot_notes=["Full debug log available at '{}'.".format(TestModule.LOG_DIR),
                    "Skipped modules {}".format(','.join(skipped_modules))])

    if any([t.name for t in tasks if not t.result.exit_code == 0]):
        sys.exit(1)
コード例 #3
0
ファイル: test.py プロジェクト: Azure/azure-cli
def run_module_tests(skip_list=None):
    print("Running tests on command modules.")

    all_modules = [TestModule(name, path) for name, path in get_all_command_modules()]
    if not skip_list is None:
        all_modules = [desc for desc in all_modules if not desc.name in skip_list]

    skipped_modules = [m.name for m in all_modules if not m.exists()]

    tasks = [Task(m.get_task_description()) for m in all_modules if m.exists()]

    Task.wait_all_tasks(tasks)

    print_records(
        [t.get_summary() for t in tasks],
        title="Test Results",
        foot_notes=["Full debug log available at '{}'.".format(TestModule.LOG_DIR),
                    "Skipped modules {}".format(','.join(skipped_modules))])

    if any([t.name for t in tasks if not t.result.exit_code == 0]):
        sys.exit(1)
コード例 #4
0
ファイル: package_verify.py プロジェクト: Azure/azure-cli
## Install the command modules using pip ##
from __future__ import print_function
import os
import sys
import fileinput
import pip
import imp
import subprocess
import tempfile
from _common import get_all_command_modules, exec_command, COMMAND_MODULE_PREFIX

PATH_TO_AZURE_CLI = os.path.abspath(os.path.join(os.path.abspath(__file__), '..', '..', '..', 'src', 'azure-cli'))
PATH_TO_AZURE_CLI_CORE = os.path.abspath(os.path.join(os.path.abspath(__file__), '..', '..', '..', 'src', 'azure-cli-core'))

all_command_modules = get_all_command_modules()

def print_heading(heading, f=None):
    print('{0}\n{1}\n{0}'.format('=' * len(heading), heading), file=f)

def set_version(path_to_setup):
    # give package a high version no. so when we install, we install this one
    # and not a version from PyPI
    for _, line in enumerate(fileinput.input(path_to_setup, inplace=1)):
        sys.stdout.write(line.replace('version=VERSION', "version='1000.0.0'"))

def build_package(path_to_package, dist_dir):
    print_heading('Building {}'.format(path_to_package))
    path_to_setup = os.path.join(path_to_package, 'setup.py')
    set_version(path_to_setup)
    cmd_success = exec_command('python setup.py sdist -d {0} bdist_wheel -d {0}'.format(dist_dir), cwd=path_to_package)
コード例 #5
0
ファイル: test.py プロジェクト: tanaka-takayoshi/azure-cli
#---------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
#---------------------------------------------------------------------------------------------

## Run the tests for each command module ##

from __future__ import print_function
import os
import sys

from _common import get_all_command_modules, exec_command, print_summary, COMMAND_MODULE_PREFIX

LOG_DIR = os.path.expanduser(os.path.join('~', '.azure', 'logs'))

all_command_modules = get_all_command_modules()
print("Running tests on command modules.")

failed_module_names = []
skipped_modules = []
for name, fullpath in all_command_modules:
    path_to_module = os.path.join(fullpath, 'azure', 'cli', 'command_modules',
                                  name.replace(COMMAND_MODULE_PREFIX, ''),
                                  'tests')
    if not os.path.isdir(path_to_module):
        skipped_modules.append(name)
        continue
    command = "python -m unittest discover -s " + path_to_module
    # append --buffer when running on CI to ensure any unrecorded tests fail instead of hang
    if os.environ.get('CONTINUOUS_INTEGRATION') and os.environ.get('TRAVIS'):
        command += " --buffer"