Exception handling for wrong testplan 45/26245/3
authorTaseer <taseer94@gmail.com>
Wed, 14 Dec 2016 04:11:39 +0000 (09:11 +0500)
committerTaseer <taseer94@gmail.com>
Tue, 20 Dec 2016 13:16:28 +0000 (18:16 +0500)
JIRA: QTIP-184

Signed-off-by: Taseer Ahmed <taseer94@gmail.com>
Change-Id: I0b989b52561526963c127fc03818cf41d67af35f

qtip/cli/commands/cmd_testplan.py

index 24899a8..200e466 100644 (file)
@@ -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)