[yocto] [qa-tools][PATCH 4/4] testopia_update: Add support to create_wiki functionality
jose.perez.carranza at linux.intel.com
jose.perez.carranza at linux.intel.com
Tue Jun 13 08:47:28 PDT 2017
From: Jose Perez Carranza <jose.perez.carranza at linux.intel.com>
Add option that allows using –create-wiki under setup option,this potion
takes date and project as a parameter and search for tests runs and
generates the wiki report data in a file.
Signed-off-by: Jose Perez Carranza <jose.perez.carranza at linux.intel.com>
---
testopia_update.py | 78 ++++++++++++++++++++++++++++++++++++++++--------------
1 file changed, 58 insertions(+), 20 deletions(-)
diff --git a/testopia_update.py b/testopia_update.py
index b438cff..0015d69 100755
--- a/testopia_update.py
+++ b/testopia_update.py
@@ -8,6 +8,7 @@ import ConfigParser
from external.testopia import Testopia
from testopia_update.product import get_products, get_product_class
+from testopia_update.utils.wikimaker import create_wiki
DEFAULT_CONFIG_FILE = "testopia_update.config"
DEFAULT_STORE_LOCATION = "/tmp/testopia_update"
@@ -153,6 +154,10 @@ def get_args():
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('--create-wiki', required=False,
+ dest="create_wiki", help='create a wiki page for the final report of \
+ the QA test cycle (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')
@@ -204,34 +209,67 @@ if __name__ == '__main__':
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']
+ if args.clone_templates:
+ setup_opts = ['clone_templates', 'project_version','branch_name',
+ 'old_project_version', 'product_name']
- load_opts(args, setup_opts, opts)
+ load_opts(args, setup_opts, opts)
+
+ product = get_product_class(args.product_name, products)
+ test_plan = product.get_test_plan(args.branch_name)
+ temp_summary = 'TRTEMP_' + args.old_project_version
+ temp_list = product.get_test_run_list(test_plan,temp_summary)
+ if not temp_list:
+ logger.error("%s: No templates found with %s string on %s"
+ % (sys.argv[0], temp_summary, args.branch_name))
+
+ for tr in temp_list:
+ if args.new_branch and args.new_branch != args.branch_name:
+ kwargs['new_branch'] = args.new_branch
+
+ new_template = product.clone_template(tr,
+ args.old_project_version,args.project_version,
+ **kwargs)
+
+ logger.info("%s: Template was created with (%d), Summary (%s)"
+ % (sys.argv[0], new_template['run_id'],
+ new_template['summary']))
+
+ elif args.create_wiki:
+ setup_opts = ['create_wiki', 'project_date', 'project_version']
+
+ load_opts(args, setup_opts, opts)
+
+ args.product_name = 'Dummy'
+ product = get_product_class(args.product_name, products)
+ summary = args.project_date + '_' + args.project_version
+
+ templates = product.get_test_run_list(None, summary)
+ wikivars = ''
+ wikivars_list = []
+ idx=0
+ for t in templates:
+ idx += 1
+ plan = product.get_test_plan_by_id(t['plan_id'])
+ prod = testopia.product_lookup_name_by_id(plan['product_id'])
+ env = product.get_environment_by_id(t['environment_id'])
+ env_name = env['name'].replace(' ','_')
+ var = str(idx) + '_' + str(prod['name']) + '_' + env_name
+ wikivars_list.append(var)
+ wikivars += ''.join(["{{#vardefine:", var, '| ',
+ str(t['run_id']), '}}', '\n' ])
+
+ print(wikivars)
+ create_wiki(wikivars, wikivars_list)
- product = get_product_class(args.product_name, products)
- test_plan = product.get_test_plan(args.branch_name)
- temp_summary = 'TRTEMP_' + args.old_project_version
- temp_list = product.get_test_run_list(test_plan,temp_summary)
- if not temp_list:
- logger.error("%s: No templates found with %s string on %s"
- % (sys.argv[0], temp_summary, args.branch_name))
-
- for tr in temp_list:
- if args.new_branch and args.new_branch != args.branch_name:
- kwargs['new_branch'] = args.new_branch
-
- new_template = product.clone_template(tr, args.old_project_version,
- args.project_version, **kwargs)
- logger.info("%s: Template was created with (%d), Summary (%s)"
- % (sys.argv[0], new_template['run_id'],
- new_template['summary']))
sys.exit(0)
--
2.11.0
More information about the yocto
mailing list