Best Python code snippet using yandex-tank
test_apply_mag_field_task.py
Source:test_apply_mag_field_task.py
...56 'go_to_field': [None]}57 )}58 self.root.task_database.prepare_for_running()59 self.task.perform()60 join_threads(self.root)61 assert_equal(self.root.get_from_database('Test_Bfield'), 2.0)62 def test_perform2(self):63 # Test multiple run when connection is maintained.64 self.task.target_field = '2.0'65 self.root.run_time['profiles'] = {'Test1': ({'owner': []},66 {'make_ready': [None],67 'go_to_field': [None],68 'check_connection': [True]69 }70 )}71 self.root.task_database.prepare_for_running()72 self.task.perform()73 join_threads(self.root)74 self.task.perform()75 join_threads(self.root)76 # In case of fail make_ready would be called twice.77 assert_equal(self.root.get_from_database('Test_Bfield'), 2.0)78@attr('ui')79class TestApplyMagFieldView(object):80 def setup(self):81 self.workbench = Workbench()82 self.workbench.register(CoreManifest())83 self.workbench.register(StateManifest())84 self.workbench.register(PreferencesManifest())85 self.workbench.register(InstrManagerManifest())86 self.workbench.register(TaskManagerManifest())87 self.root = RootTask(should_stop=Event(), should_pause=Event())88 self.task = ApplyMagFieldTask(task_name='Test')89 self.root.children_task.append(self.task)...
threadedfunction.py
Source:threadedfunction.py
1# Python 2 and 32import multiprocessing3import logging4logger = logging.getLogger('threadtools.threadedfunction')5class threadedFunction(multiprocessing.Process):6 def __init__(self, group=None, target=None, name=None,7 args=(), kwargs={}, join_threads=[], verbose=None):8 multiprocessing.Process.__init__(self, group=group,9 target=target,10 name=name)11 self.func = args[0]12 self.args = args[1:]13 self.kwargs = kwargs14 self.out = None15 self.join_threads = join_threads16 return17 def run(self):18 logger.info('Starting function in thread {0}'.format(self.name))19 # for arg in self.args:20 # print arg21 # for key, arg in self.kwargs.iteritems():22 # print key23 # print arg24 self.out = self.func(*self.args, **self.kwargs)25 logger.info("done process {0}".format(self.name))...
main.py
Source:main.py
...9"""1011def main():12 threads = alco_sync()13 join_threads(threads)1415 threads = penticton_sync()16 join_threads(threads)1718 threads = morowat_sync()19 join_threads(threads)2021 print("Finished Sync. Hooray!")2223def join_threads(threads_list):24 for t in threads_list:25 t.join()2627if __name__=="__main__":
...
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!!