Best Python code snippet using avocado_python
CreateDeleteRTCTest.py
Source:CreateDeleteRTCTest.py
...53fodat = "=== " + test_case + " start ==="54print_file_and_cons(fodat)55loop_cnt = 100056## -----------------------------------------------------------------------------57fodat = "load_module() and unload_module()"58print_file_and_cons(fodat)59for i in range(loop_cnt):60 ## Manager::unload_module(in string pathname);61 try:62 #retcode = manager.unload_module(".//ConsoleIn.so")63 retcode = manager.unload_module(".//ConsoleOut.so")64 except:65 pass66 #print "unload_module() ret=",retcode67 ## Manager::load_module(in string pathname, in string initfunc); 68 #retcode = manager.load_module("ConsoleIn.so", "ConsoleInInit")69 retcode = manager.load_module("ConsoleOut.so", "ConsoleOutInit")70 #print "load_module() ret=",retcode71 if i == 0:72 rss0 = mem_rss() ; j0 = 0 ; rssStart = rss073 fodat = " %05d: %s KB start" % (1, rss0)74 print_file_and_cons(fodat,1)75 rss1 = mem_rss() ; j1 = i76 if rss0 != rss1:77 fodat = " %05d: %s KB -> %d KB. count diff -> %d" % (i+1, rss1,int(rss1)-int(rss0),int(j1)-int(j0) )78 print_file_and_cons(fodat,1)79 rss0 = rss1 ; j0 = j180rssEnd = mem_rss()81fodat = " %05d: %s KB end" % (i+1, rssEnd)82print_file_and_cons(fodat,1)83leak_check(rssStart, rssEnd)84## -----------------------------------------------------------------------------85fodat = "create_component() and delete_component()"86print_file_and_cons(fodat)87for i in range(loop_cnt):88 ## Manager::delete_component(in string instance_name);89 ret0 = manager.delete_component("ConsoleOut0")90 #ret0 = manager.delete_component("ConsoleIn0")91 #print " delete_comp() ret=",ret092 ## Manager::create_component(in string module_name); 93 obj0 = manager.create_component("ConsoleOut")94 #obj0 = manager.create_component("ConsoleIn")95 #print " create_comp() ret_Ref=",obj096 if i == 0:97 rss0 = mem_rss() ; j0 = 0 ; rssStart = rss098 fodat = " %05d: %s KB start" % (1, rss0)99 print_file_and_cons(fodat,1)100 rss1 = mem_rss() ; j1 = i101 if rss0 != rss1:102 fodat = " %05d: %s KB -> %d KB. count diff -> %d" % (i+1, rss1,int(rss1)-int(rss0),int(j1)-int(j0) )103 print_file_and_cons(fodat,1)104 rss0 = rss1 ; j0 = j1105rssEnd = mem_rss()106fodat = " %05d: %s KB end" % (i+1, rssEnd)107print_file_and_cons(fodat,1)108leak_check(rssStart, rssEnd)109## -----------------------------------------------------------------------------110fodat = "=== " + test_case + " end ==="111print_file_and_cons(fodat)112fout.close()113manager.delete_component("ConsoleOut0")114#manager.delete_component("ConsoleIn0")...
test_unload_module.py
Source:test_unload_module.py
...17 self.refresh_keys = self.set_up_patch(18 'raptiformica.actions.modules.refresh_keys'19 )20 def test_unload_module_determines_clone_data(self):21 unload_module('vdloo/puppetfiles')22 self.determine_clone_data.assert_called_once_with(23 'vdloo/puppetfiles'24 )25 def test_unload_module_gets_on_disk_mapping_from_module(self):26 unload_module('vdloo/puppetfiles')27 self.on_disk_mapping.assert_called_once_with(28 module_dirs=(join(conf().USER_MODULES_DIR, 'puppetfiles'),)29 )30 def test_unload_module_removes_keys(self):31 unload_module('vdloo/puppetfiles')32 self.remove_keys.assert_called_once_with(33 self.on_disk_mapping.return_value,34 join(conf().USER_MODULES_DIR, 'puppetfiles')35 )36 def test_unload_module_refreshes_keys(self):37 unload_module('vdloo/puppetfiles')38 self.refresh_keys.assert_called_once_with(39 self.on_disk_mapping.return_value...
__init__.py
Source:__init__.py
...14env = ImportEnv()15env.__enter__()16parent_dir = Path(__file__).parent.parent17env.add_path(parent_dir)18env.unload_module("utils")19env.unload_module("torchreid")20env.unload_module("models.common")21env.unload_module("models")22from utils.box_extract import BoxExtractor, BoxExtractorIdentity23from utils.reid import ReIdGallery24from utils.reid_predictor import ReIdPredictor25env.__exit__(None, None, None)26"""...
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!!