Directory independant 'perftest list' command execution. 43/23943/5
authorlinux_geek <taseer94@gmail.com>
Thu, 3 Nov 2016 15:35:58 +0000 (20:35 +0500)
committerlinux_geek <taseer94@gmail.com>
Sun, 6 Nov 2016 02:43:30 +0000 (07:43 +0500)
JIRA: QTIP-141

Change-Id: I5a4fce5d8b13c9443bc1be13cb174a78a262e8b6
Signed-off-by: Taseer Ahmed <taseer94@gmail.com>
cli/commands/perftest.py
cli/helper.py [new file with mode: 0644]

index c163070..0eb6d06 100644 (file)
 from prettytable import PrettyTable
 import yaml
 import click
+import os
+from cli import helper
 
 
 class PerfTest:
 
     def __init__(self):
-        self.path = 'benchmarks/perftest/summary'
+        self.path = os.path.join(helper.fetch_root(), 'perftest/summary')
 
     def list(self):
         table = PrettyTable(["Name", "Description"])
diff --git a/cli/helper.py b/cli/helper.py
new file mode 100644 (file)
index 0000000..a5865bc
--- /dev/null
@@ -0,0 +1,14 @@
+##############################################################################
+# 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 os
+
+
+def fetch_root():
+    return os.path.join(os.path.dirname(__file__), os.pardir, 'benchmarks/')