Best Python code snippet using autotest_python
control_file.py
Source:control_file.py
...65def step_init():66 # a host object we use solely for the purpose of finding out the booted67 # kernel version, we use machines[0] since we already check that the same68 # kernel has been booted on all machines69 step_reinstall()70 if len(kernel_list) > 1:71 kernel_host = hosts.create_host(machines[0])72 for kernel_info in kernel_list:73 func = lambda machine: install_kernel(machine, kernel_info)74 good_machines = job.parallel_on_machines(func, machines)75 if len(good_machines) < num_machines_required:76 raise error.TestError(77 "kernel installed on only %%%%d of %%%%d machines."78 %%%% (len(good_machines), num_machines_required))79 # Replace the machines list that step_test() will use with the80 # ones that successfully installed the kernel.81 machines[:] = good_machines82 # have server_job.run_test() automatically add the kernel version as83 # a suffix to the test name otherwise we cannot run the same test on84 # different kernel versions85 if len(kernel_list) > 1:86 job.automatic_test_tag = kernel_host.get_kernel_ver()87 step_test()88def step_reinstall():89 def run(machine):90 host = hosts.create_host(machine, initialize=False)91 job.run_test('reinstall', host=host, disable_sysinfo=True)92 job.parallel_simple(run, machines)93def step_test():94""" % CLIENT_KERNEL_TEMPLATE95CLIENT_STEP_TEMPLATE = " job.next_step('step%d')\n"96SERVER_STEP_TEMPLATE = ' step%d()\n'97UPLOAD_CONFIG_FUNC = """98def upload_kernel_config(host, kernel_info):99 \"""100 If the kernel_info['config_file'] is a URL it will be downloaded101 locally and then uploaded to the client and a copy of the original102 dictionary with the new path to the config file will be returned....
git_cmake_recipe.py
Source:git_cmake_recipe.py
...70 # go to our build directory71 workdir(self.build_path)72 # run scons && scons install73 run(self.build_cmd)74 def step_reinstall(self):75 """Delete everything and start over"""76 # clear sources directories if needed77 run('rm -rf {}'.format(self.app_path))78 # Now run build root...
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.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!