[yocto] [qa-tools][PATCH] testopia_update: Add functionality to list templates
jose.perez.carranza at linux.intel.com
jose.perez.carranza at linux.intel.com
Fri Jun 2 10:21:30 PDT 2017
From: Jose Perez Carranza <jose.perez.carranza at linux.intel.com>
Add support to list available templates per specific releases
Signed-off-by: Jose Perez Carranza <jose.perez.carranza at linux.intel.com>
---
testopia_update.py | 18 ++++++++++++++++--
testopia_update/product/__init__.py | 9 +++++++--
2 files changed, 23 insertions(+), 4 deletions(-)
diff --git a/testopia_update.py b/testopia_update.py
index fa8d10c..b438cff 100755
--- a/testopia_update.py
+++ b/testopia_update.py
@@ -109,6 +109,8 @@ def get_args():
parser.add_argument('--list-products', required=False, action="store_true",
dest="list_products", default=False, help='List available products.')
+ parser.add_argument('--list-templates', required=False, action="store_true",
+ dest="list_templates", default=False, help='List available templates.')
parser.add_argument('-a', '--action', required=False, dest='action',
choices=ACTIONS,
@@ -148,8 +150,8 @@ def get_args():
dest="old_project_version", help='Version of the project to clone from')
parser.add_argument('--clone-templates', required=False,
- dest="clone_templates", help='clone templates from one brnach to \
- another or same branch (only avaibale) \
+ dest="clone_templates", help='clone templates from one branch to \
+ another or same branch (only available) \
with setup action', const='Y', nargs='?')
parser.add_argument('--new-branch', required=False,
dest="new_branch", help='New branch to clone the Templates')
@@ -195,6 +197,18 @@ if __name__ == '__main__':
print("%s\n" % p.name)
sys.exit(0)
+ if args.list_templates:
+ if not args.project_version:
+ logger.error("--project-version should be specified")
+ else:
+ args.product_name = 'Dummy'
+ product = get_product_class(args.product_name, products)
+ summary = 'TRTEMP_' + args.project_version
+ templates = product.get_test_run_list(None, summary)
+ for t in templates:
+ print ("%s - %s " % (t['run_id'], t['summary']))
+ sys.exit(0)
+
if args.action == 'setup':
setup_opts = ['clone_templates', 'project_version','branch_name',
'old_project_version', 'product_name']
diff --git a/testopia_update/product/__init__.py b/testopia_update/product/__init__.py
index ba34d02..a24196a 100644
--- a/testopia_update/product/__init__.py
+++ b/testopia_update/product/__init__.py
@@ -216,8 +216,13 @@ class Product(object):
return tr_id
def get_test_run_list(self, test_plan, temp_summary):
- list_test_runs = self.testopia.testrun_list(plan_id=test_plan['plan_id'],
- summary=temp_summary)
+ try:
+ plan_id = test_plan['plan_id']
+ except:
+ plan_id = test_plan
+
+ list_test_runs = self.testopia.testrun_list(plan_id,
+ summary=temp_summary)
return list_test_runs
--
2.11.0
More information about the yocto
mailing list