testopia_update: Add option to define test plan
PATCH 1/1 testopia_update: Add option to define test plan
From: Jose Perez Carranza <[email protected]>
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 <[email protected]>
--- testopia_update.py | 11 +++++++++-- testopia_update/product/__init__.py | 6 +++--- 2 files changed, 12 insertions(+), 5 deletions(-)
testopia_update.py +9 -2
@@ -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)
testopia_update/product/__init__.py +3 -3
@@ -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))
Signature · 1 line
2.11.0