From 60f1f328b2ebc94330dcbf5f4374684a410d3e92 Mon Sep 17 00:00:00 2001 From: MatthewLi Date: Thu, 5 Jan 2017 02:02:13 -0500 Subject: dovetail tool: command line JIRA: DOVETAIL-173 details please see https://wiki.opnfv.org/display/dovetail/Dovetail+Command+Line Change-Id: Iff04b0df8c4e6310d35a45b9c8ba3c7b3b5e1105 Signed-off-by: MatthewLi --- dovetail/cli/cli_base.py | 56 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 dovetail/cli/cli_base.py (limited to 'dovetail/cli/cli_base.py') diff --git a/dovetail/cli/cli_base.py b/dovetail/cli/cli_base.py new file mode 100644 index 00000000..c0d57e86 --- /dev/null +++ b/dovetail/cli/cli_base.py @@ -0,0 +1,56 @@ +############################################################################## +# Copyright (c) 2016 Huawei Technologies Co.,Ltd and others. +# +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## +import click +from pbr import version +from dovetail.cli.commands.cli_testcase import CliTestcase + + +CONTEXT_SETTINGS = dict(help_option_names=['-h', '--help']) +cli_version = version.VersionInfo('dovetail').version_string() + + +@click.group(context_settings=CONTEXT_SETTINGS) +@click.version_option(version=cli_version) +def cli(): + pass + + +_testcase = CliTestcase() + + +@cli.command('list', + help='list the testsuite details') +@click.argument('testsuite', type=click.STRING, required=False) +def testcase_list(testsuite): + _testcase.list_testcase(testsuite) + + +@cli.command('show', + help='show the testcases details') +@click.argument('testcase', type=click.STRING, required=True) +def testcase_show(testcase): + _testcase.show_testcase(testcase) + + +@cli.command('run', + context_settings=dict( + ignore_unknown_options=True, help_option_names=[]), + help='run the testcases') +@click.argument('run_args', nargs=-1, type=click.UNPROCESSED) +def testcase_run(run_args): + args_list = [] + list(run_args) + args_str = ' '.join(args_list) + _testcase.run(args_str) + + +# @cli.command('report', help='testcases running result report') +# @click.option('--encrypt', default=True, +# help='report the test result with encryption') +# def run(**kwargs): +# CliReport.execute(**kwargs) -- cgit 1.2.3-korg