From: Jose Perez Carranza <jose.perez.carra...@linux.intel.com> Currently the tempates has a format as below:
TRTEMP_<RELEASE>_<MANUAL/AUTO>_<COMPONENT>_<OPTIONAL> Hence the logic was adapted to follow above structure and also a commit paramater was added to follow the format of build as follows: RELEASE MILESTONE_rc# Signed-off-by: Jose Perez Carranza <jose.perez.carra...@linux.intel.com> --- testopia_update.py | 11 ++++++----- testopia_update/product/__init__.py | 26 ++++++++++++++------------ 2 files changed, 20 insertions(+), 17 deletions(-) diff --git a/testopia_update.py b/testopia_update.py index 249d163..1c2db63 100755 --- a/testopia_update.py +++ b/testopia_update.py @@ -15,7 +15,7 @@ DEFAULT_STORE_LOCATION = "/tmp/testopia_update" ACTIONS = ('create', 'update') BRANCHES = ('master', 'jethro', 'dizzy', 'daisy', 'noexists') -CATEGORIES = ('Full pass', 'Weekly') +CATEGORIES = ('AUTO', 'MANUAL') class Options(object): pass @@ -68,6 +68,7 @@ def get_args(): parser.add_argument('--debug', required=False, action="store_true", dest="debug", default=False, help='Enable debug mode.') + return parser.parse_args() if __name__ == '__main__': @@ -87,7 +88,7 @@ if __name__ == '__main__': testopia_opts = testopia_config + ['action', 'product_name', 'category_name', 'project_version', 'project_milestone', 'project_revision', 'project_date'] - + config = None if not args.config and os.path.exists(DEFAULT_CONFIG_FILE): args.config = DEFAULT_CONFIG_FILE @@ -172,8 +173,8 @@ if __name__ == '__main__': sys.exit(1) if args.action == "create": - template_test_run = product.get_template_test_run(test_plan, args.project_version, - args.category_name, args.optional) + template_test_run = product.get_template_test_run(test_plan, + args.project_version, args.category_name, args.optional) if not template_test_run: logger.error("%s: Product %s can't find test run with: "\ "%s, %s, %s." % (sys.argv[0], args.product_name, @@ -189,7 +190,7 @@ if __name__ == '__main__': args.optional)) sys.exit(1) logger.info("%s: Test run was created with Template (%d), Summary (%s)"\ - " and ID (%s)." % (sys.argv[0], template_test_run['run_id'], + " and ID (%s)." % (sys.argv[0], template_test_run['run_id'], test_run['summary'], test_run['run_id'])) elif args.action == "update": if not args.results_log: diff --git a/testopia_update/product/__init__.py b/testopia_update/product/__init__.py index 04f9dac..689d004 100644 --- a/testopia_update/product/__init__.py +++ b/testopia_update/product/__init__.py @@ -1,5 +1,6 @@ import re + class Product(object): def __init__(self, testopia, opts, logger, config): self.testopia = testopia @@ -45,8 +46,8 @@ class Product(object): def _format_build_name(self, project_version, project_revision): return "%s: %s" % (project_version, project_revision) - def get_build(self, tp, project_version, project_milestone, - project_revision, project_date): + def get_build(self, tp, project_version, project_milestone, project_revision, + project_date): builds = self.testopia.product_get_builds(tp['product_id']) build_name = self._format_build_name(project_milestone, project_revision) for b in builds: @@ -66,14 +67,14 @@ class Product(object): def _get_test_run_summary_alternatives(self, ttype, project_version, category_name, optional): summary_alts = [] - summary_alts.append('%s - %s - %s - %s' % (ttype, self.name, - project_version, category_name)) - summary_alts.append('%s - %s - %s' % (ttype, project_version, + summary_alts.append('%s_%s_%s_%s' % (ttype, project_version, + category_name, self.name)) + summary_alts.append('%s_%s_%s' % (ttype, project_version, category_name)) - summary_alts.append('%s - %s' % (ttype, category_name)) - if optional: + summary_alts.append('%s_%s' % (ttype, category_name)) + if optional: for idx, sa in enumerate(summary_alts): - summary_alts[idx] = sa + " - %s" % optional + summary_alts[idx] = sa + "_%s" % optional return summary_alts def get_template_test_run(self, tp, project_version, category_name, @@ -85,7 +86,7 @@ class Product(object): first match of summary in test runs. """ - summary_alts = self._get_test_run_summary_alternatives("TEMPLATE", + summary_alts = self._get_test_run_summary_alternatives("TRTEMP", project_version, category_name, optional) tp_test_runs = self.testopia.testplan_get_test_runs(tp['plan_id']) @@ -100,7 +101,7 @@ class Product(object): def get_test_run(self, tp, env, build, project_date, project_version, category_name, optional): - summary_alts = self._get_test_run_summary_alternatives(project_date, + summary_alts = self._get_test_run_summary_alternatives(project_date, project_version, category_name, optional) tp_test_runs = self.testopia.testplan_get_test_runs(tp['plan_id']) @@ -133,8 +134,9 @@ class Product(object): return project_version - def create_test_run(self, tp, env, build, template_tr, project_version, project_date): - summary = template_tr['summary'].replace('TEMPLATE', project_date) + def create_test_run(self, tp, env, build, template_tr, project_version, + project_date): + summary = template_tr['summary'].replace('TRTEMP', project_date) test_case_ids = self._get_test_case_ids(template_tr) new_test_run = self.testopia.testrun_create(build['build_id'], -- 2.1.4 -- _______________________________________________ yocto mailing list yocto@yoctoproject.org https://lists.yoctoproject.org/listinfo/yocto