summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTaseer <taseer94@gmail.com>2016-12-14 09:11:39 +0500
committerTaseer <taseer94@gmail.com>2016-12-20 18:16:28 +0500
commit55f8056a2a7a9e256c8b01ec1b255f4b769ced14 (patch)
treece603dd49a8b6b7e858a6cca481431b7c7db34f1
parenteb074711d7ae91665fe8a2063820703fae4ab3aa (diff)
Exception handling for wrong testplan
JIRA: QTIP-184 Signed-off-by: Taseer Ahmed <taseer94@gmail.com> Change-Id: I0b989b52561526963c127fc03818cf41d67af35f
-rw-r--r--qtip/cli/commands/cmd_testplan.py16
1 files 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)