From 929bcdf94d14062e042d9f9451c28315a18e808d Mon Sep 17 00:00:00 2001 From: Yujun Zhang Date: Wed, 21 Dec 2016 00:19:46 +0800 Subject: Implment https://wiki.opnfv.org/display/qtip/Design Note that some obsolete test cases are marked expected failure, will be deprecated after architecture evolution. JIRA: QTIP-148 Change-Id: I52bc9391569d516e298d9e659517161b4dce794a Signed-off-by: Yujun Zhang --- qtip/cli/commands/cmd_plan.py | 43 ++++++++++++++++++++++++++++++++++ qtip/cli/commands/cmd_testplan.py | 49 --------------------------------------- 2 files changed, 43 insertions(+), 49 deletions(-) create mode 100644 qtip/cli/commands/cmd_plan.py delete mode 100644 qtip/cli/commands/cmd_testplan.py (limited to 'qtip/cli') diff --git a/qtip/cli/commands/cmd_plan.py b/qtip/cli/commands/cmd_plan.py new file mode 100644 index 00000000..01bf8251 --- /dev/null +++ b/qtip/cli/commands/cmd_plan.py @@ -0,0 +1,43 @@ +############################################################################# +# Copyright (c) 2016 ZTE Corp 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 prettytable import PrettyTable +from qtip.runner.plan import Plan + + +@click.group() +def cli(): + pass + + +@cli.group() +def plan_cmd(): + pass + + +@plan_cmd.command('list', help='List the different TestPlans.') +def list_all(): + plans = Plan.list_all() + table = PrettyTable(["Testplans"]) + table.align = 'l' + for plan in plans: + table.add_row([plan['name']]) + click.echo(table) + + +@plan_cmd.command('show', help='Show details of specified TestPlan.') +@click.argument('name') +def show(name): + plan = Plan(name) + results = plan.content() + table = PrettyTable(["Name", "Description"]) + table.align = 'l' + table.add_row([results['name'], results['description']]) + click.echo(table) diff --git a/qtip/cli/commands/cmd_testplan.py b/qtip/cli/commands/cmd_testplan.py deleted file mode 100644 index 200e4665..00000000 --- a/qtip/cli/commands/cmd_testplan.py +++ /dev/null @@ -1,49 +0,0 @@ -############################################################################# -# Copyright (c) 2016 ZTE Corp 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 -import sys -from prettytable import PrettyTable - -from qtip.runner.testplan import TestPlan - - -@click.group() -def cli(): - pass - - -@cli.group() -def testplan(): - pass - - -@testplan.command('list', help='List the different TestPlans.') -def list(): - testplans = TestPlan.list_all() - table = PrettyTable(["Testplans"]) - table.align = 'l' - for testplan in testplans: - table.add_row([testplan['name']]) - click.echo(table) - - -@testplan.command('show', help='Show details of specified TestPlan.') -@click.argument('name') -def show(name): - plan = TestPlan(name) - desc = plan.describe() - if desc['abspath'] is None: - click.echo("Wrong TestPlan specified") - sys.exit(1) - else: - table = PrettyTable(["Name", "Description"]) - table.align = 'l' - table.add_row([desc['name'], desc['description']]) - click.echo(table) -- cgit 1.2.3-korg