How to use add_label_dependencies method in autotest

Best Python code snippet using autotest_python Github


Full Screen

...272 int(new_test['experimental']), int(new_test['run_verify']),273 new_test['time'], new_test['test_category'],274 new_test['sync_count'])275 db_execute(cursor, sql)276 add_label_dependencies(new_test_dicts, cursor)277 connection.commit()278 connection.close()279def dict_db_clean(test):280 """Take a tests dictionary from update_db and make it pretty for SQL"""281 test_type = { 'client' : 1,282 'server' : 2, }283 test_time = { 'short' : 1,284 'medium' : 2,285 'long' : 3, }286 test['name'] = MySQLdb.escape_string(test['name'])287 test['author'] = MySQLdb.escape_string(test['author'])288 test['test_class'] = MySQLdb.escape_string(test['test_class'])289 test['test_category'] = MySQLdb.escape_string(test['test_category'])290 test['doc'] = MySQLdb.escape_string(test['doc'])291 test['dependencies'] = ", ".join(test['dependencies'])292 # TODO Fix when we move from synch_type to sync_count293 if test['sync_count'] == 1:294 test['synch_type'] = 1295 else:296 test['synch_type'] = 2297 try:298 test['test_type'] = int(test['test_type'])299 if test['test_type'] != 1 and test['test_type'] != 2:300 raise Exception('Incorrect number %d for test_type' %301 test['test_type'])302 except ValueError:303 pass304 try:305 test['time'] = int(test['time'])306 if test['time'] < 1 or test['time'] > 3:307 raise Exception('Incorrect number %d for time' %308 test['time'])309 except ValueError:310 pass311 if str == type(test['time']):312 test['time'] = test_time[test['time'].lower()]313 if str == type(test['test_type']):314 test['test_type'] = test_type[test['test_type'].lower()]315 return test316def add_label_dependencies(tests, cursor):317 """318 Look at the DEPENDENCIES field for each test and add the proper many-to-many319 relationships.320 """321 label_name_to_id = get_id_map(cursor, 'labels', 'name')322 test_path_to_id = get_id_map(cursor, 'autotests', 'path')323 # clear out old relationships324 test_ids = ','.join(str(test_path_to_id[test['path']])325 for test in tests)326 db_execute(cursor,327 'DELETE FROM autotests_dependency_labels WHERE test_id IN (%s)' %328 test_ids)329 value_pairs = []330 for test in tests:...

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:


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?