How to use _job_keyvals_to_dict method in autotest

Best Python code snippet using autotest_python

rpc_interface.py

Source:rpc_interface.py Github

copy

Full Screen

...142 # merge the iterations into a single list of attr & perf dicts143 return [{'attr': iteration_attr.get(index, {}),144 'perf': iteration_perf.get(index, {})}145 for index in xrange(1, max_iterations + 1)]146def _job_keyvals_to_dict(keyvals):147 return dict((keyval.key, keyval.value) for keyval in keyvals)148def get_detailed_test_views(**filter_data):149 test_views = models.TestView.list_objects(filter_data)150 tests_by_id = models.Test.objects.in_bulk([test_view['test_idx']151 for test_view in test_views])152 tests = tests_by_id.values()153 models.Test.objects.populate_relationships(tests, models.TestAttribute,154 'attributes')155 models.Test.objects.populate_relationships(tests, models.IterationAttribute,156 'iteration_attributes')157 models.Test.objects.populate_relationships(tests, models.IterationResult,158 'iteration_results')159 models.Test.objects.populate_relationships(tests, models.TestLabel,160 'labels')161 jobs_by_id = models.Job.objects.in_bulk([test_view['job_idx']162 for test_view in test_views])163 jobs = jobs_by_id.values()164 models.Job.objects.populate_relationships(jobs, models.JobKeyval,165 'keyvals')166 for test_view in test_views:167 test = tests_by_id[test_view['test_idx']]168 test_view['attributes'] = _attributes_to_dict(test.attributes)169 test_view['iterations'] = _format_iteration_keyvals(test)170 test_view['labels'] = [label.name for label in test.labels]171 job = jobs_by_id[test_view['job_idx']]172 test_view['job_keyvals'] = _job_keyvals_to_dict(job.keyvals)173 return rpc_utils.prepare_for_serialization(test_views)174def get_tests_summary(job_names):175 """176 Gets the count summary of all passed and failed tests per suite.177 @param job_names: Names of the suite jobs to get the summary from.178 @returns: A summary of all the passed and failed tests per suite job.179 """180 # Take advantage of Django's literal escaping to prevent SQL injection181 sql_list = ','.join(['%s'] * len(job_names))182 query = ('''SELECT job_name, IF (status = 'GOOD', status, 'FAIL')183 AS test_status, COUNT(*) num184 FROM tko_test_view_2185 WHERE job_name IN (%s)186 AND test_name <> 'SERVER_JOB'...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run autotest automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful