[yocto] [qa-tools][PATCH] testopia_update: Add option to define test plan

jose.perez.carranza at linux.intel.com jose.perez.carranza at linux.intel.com
Mon Mar 6 10:11:13 PST 2017


From: Jose Perez Carranza <jose.perez.carranza at linux.intel.com>

There are cases where the test plan and the product name are not equal hence
an option is added to handle those cases and define thetest plan to work on.

Signed-off-by: Jose Perez Carranza <jose.perez.carranza at linux.intel.com>
---
 testopia_update.py                  | 11 +++++++++--
 testopia_update/product/__init__.py |  6 +++---
 2 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/testopia_update.py b/testopia_update.py
index 9b35188..1dd40cd 100755
--- a/testopia_update.py
+++ b/testopia_update.py
@@ -70,6 +70,9 @@ def get_args():
         dest="project_revision", help='SCM Revision of the project.')
     parser.add_argument('--project-date', required=False,
         dest="project_date", help='SCM version/revision date of the project.')
+    parser.add_argument('--test-plan', required=False,
+        dest="plan_name", help='Name of the test plan of the product, used when \
+                                test plan name is different from product name.')
 
     parser.add_argument('--results-log', required=False,
         dest="results_log", help='Results log.')
@@ -139,10 +142,14 @@ if __name__ == '__main__':
             (sys.argv[0], args.product_name))
         sys.exit(1)
 
+    product.plan = args.plan_name
+    if not product.plan:
+        product.plan = product.name
+
     test_plan = product.get_test_plan(args.branch_name)
     if not test_plan:
-        logger.error("%s: Test plan for product %s and branch %s not exists."\
-             % (sys.argv[0], args.product_name, args.branch_name))
+        logger.error("%s: Test plan %s for product %s and branch %s not exists."\
+             % (sys.argv[0], product.plan ,args.product_name, args.branch_name))
 
         sys.exit(1)
 
diff --git a/testopia_update/product/__init__.py b/testopia_update/product/__init__.py
index e401824..023fb02 100644
--- a/testopia_update/product/__init__.py
+++ b/testopia_update/product/__init__.py
@@ -16,11 +16,11 @@ class Product(object):
     def get_test_plan(self, branch_name):
         tp = None
 
-        tp_name = '%s: %s branch' % (self.name, branch_name)
+        tp_name = '%s: %s branch' % (self.plan, branch_name)
 
         tp = self.testopia.testplan_list(name=tp_name)
         if not tp:
-            tp_alt_name = '%s: %s branch' % (self.name, branch_name.lower())
+            tp_alt_name = '%s: %s branch' % (self.plan, branch_name.lower())
             tp = self.testopia.testplan_list(name=tp_alt_name)
 
         if tp:
@@ -68,7 +68,7 @@ class Product(object):
             category_name, optional):
         summary_alts = []
         summary_alts.append('%s_%s_%s_%s' % (ttype, project_version,
-            category_name, self.name))
+            category_name, self.plan))
         summary_alts.append('%s_%s_%s' % (ttype, project_version,
             category_name))
         summary_alts.append('%s_%s' % (ttype, category_name))
-- 
2.11.0




More information about the yocto mailing list