From 55f8056a2a7a9e256c8b01ec1b255f4b769ced14 Mon Sep 17 00:00:00 2001 From: Taseer Date: Wed, 14 Dec 2016 09:11:39 +0500 Subject: Exception handling for wrong testplan JIRA: QTIP-184 Signed-off-by: Taseer Ahmed Change-Id: I0b989b52561526963c127fc03818cf41d67af35f --- qtip/cli/commands/cmd_testplan.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/qtip/cli/commands/cmd_testplan.py b/qtip/cli/commands/cmd_testplan.py index 24899a84..200e4665 100644 --- a/qtip/cli/commands/cmd_testplan.py +++ b/qtip/cli/commands/cmd_testplan.py @@ -8,7 +8,9 @@ ############################################################################## import click +import sys from prettytable import PrettyTable + from qtip.runner.testplan import TestPlan @@ -36,8 +38,12 @@ def list(): @click.argument('name') def show(name): plan = TestPlan(name) - results = plan.describe() - table = PrettyTable(["Name", "Description"]) - table.align = 'l' - table.add_row([results['name'], results['description']]) - click.echo(table) + 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