Best Python code snippet using autotest_python
test_balance.py
Source:test_balance.py
...24 workload_id_1 = "w1"25 # Put 2 cross package violation on the current cpu26 cur_cpu = get_cpu()27 # W0 is on the first threads of package 0 and 128 cur_cpu.get_packages()[0].get_threads()[0].claim(workload_id_0)29 cur_cpu.get_packages()[1].get_threads()[0].claim(workload_id_0)30 # W1 is on the second threads of package 0 and 131 cur_cpu.get_packages()[0].get_threads()[1].claim(workload_id_1)32 cur_cpu.get_packages()[1].get_threads()[1].claim(workload_id_1)33 # Put 1 cross package violation on the new cpu34 new_cpu = get_cpu()35 # W0 is on the first threads of package 0 and 1 (unchanged)36 new_cpu.get_packages()[0].get_threads()[0].claim(workload_id_0)37 new_cpu.get_packages()[1].get_threads()[0].claim(workload_id_0)38 # W1 is on the second and third threads of package 0 (better)39 new_cpu.get_packages()[0].get_threads()[1].claim(workload_id_1)40 new_cpu.get_packages()[0].get_threads()[2].claim(workload_id_1)41 self.assertTrue(has_better_isolation(cur_cpu, new_cpu))42 def test_cross_package_violations_have_increased(self):43 workload_id_0 = "w0"44 workload_id_1 = "w1"45 # Put 1 cross package violation on the new cpu46 cur_cpu = get_cpu()47 # W0 is on the first threads of package 0 and 1 (unchanged)48 cur_cpu.get_packages()[0].get_threads()[0].claim(workload_id_0)49 cur_cpu.get_packages()[1].get_threads()[0].claim(workload_id_0)50 # Put 2 cross package violation on the current cpu51 new_cpu = get_cpu()52 # W0 is on the first threads of package 0 and 153 new_cpu.get_packages()[0].get_threads()[0].claim(workload_id_0)54 new_cpu.get_packages()[1].get_threads()[0].claim(workload_id_0)55 # W1 is on the second threads of package 0 and 156 new_cpu.get_packages()[0].get_threads()[1].claim(workload_id_1)57 new_cpu.get_packages()[1].get_threads()[1].claim(workload_id_1)58 self.assertFalse(has_better_isolation(cur_cpu, new_cpu))59 def test_only_shared_cores_have_decreased(self):60 workload_id_0 = "w0"61 workload_id_1 = "w1"62 # Share two cores on the current cpu63 cur_cpu = get_cpu()64 # Core 0 is shared by w0 and w165 cur_cpu.get_packages()[0].get_cores()[0].get_threads()[0].claim(workload_id_0)66 cur_cpu.get_packages()[0].get_cores()[0].get_threads()[1].claim(workload_id_1)67 # Core 1 is shared by w0 and w168 cur_cpu.get_packages()[0].get_cores()[1].get_threads()[0].claim(workload_id_0)69 cur_cpu.get_packages()[0].get_cores()[1].get_threads()[1].claim(workload_id_1)70 # Share zero cores on the new cpu71 new_cpu = get_cpu()72 # Core 0 is wholly consumed by w073 new_cpu.get_packages()[0].get_cores()[0].get_threads()[0].claim(workload_id_0)74 new_cpu.get_packages()[0].get_cores()[0].get_threads()[1].claim(workload_id_0)75 # Core 1 is wholly consumed by w176 new_cpu.get_packages()[0].get_cores()[1].get_threads()[0].claim(workload_id_1)77 new_cpu.get_packages()[0].get_cores()[1].get_threads()[1].claim(workload_id_1)78 self.assertTrue(has_better_isolation(cur_cpu, new_cpu))79 def test_only_shared_cores_have_increased(self):80 workload_id_0 = "w0"81 workload_id_1 = "w1"82 # Share two cores on the current cpu83 cur_cpu = get_cpu()84 # Core 0 is wholly consumed by w085 cur_cpu.get_packages()[0].get_cores()[0].get_threads()[0].claim(workload_id_0)86 cur_cpu.get_packages()[0].get_cores()[0].get_threads()[1].claim(workload_id_0)87 # Core 1 is wholly consumed by w188 cur_cpu.get_packages()[0].get_cores()[1].get_threads()[0].claim(workload_id_1)89 cur_cpu.get_packages()[0].get_cores()[1].get_threads()[1].claim(workload_id_1)90 # Share zero cores on the new cpu91 new_cpu = get_cpu()92 # Core 0 is shared by w0 and w193 new_cpu.get_packages()[0].get_cores()[0].get_threads()[0].claim(workload_id_0)94 new_cpu.get_packages()[0].get_cores()[0].get_threads()[1].claim(workload_id_1)95 # Core 1 is shared by w0 and w196 new_cpu.get_packages()[0].get_cores()[1].get_threads()[0].claim(workload_id_0)97 new_cpu.get_packages()[0].get_cores()[1].get_threads()[1].claim(workload_id_1)...
test_Default.py
Source:test_Default.py
...53 ("pyOpenSSL"),54 ("cryptography")55])56def test_required_pip3_packages_exist(host, pip3_packages):57 packaging = host.pip_package.get_packages(pip_path='pip3')['packaging']58# requests = host.pip_package.get_packages(pip_path='pip3')['requests[security]']59# xmltodict = host.pip_package.get_packages(pip_path='pip3')['xmltodict']60# azure-cli-core = host.pip_package.get_packages(pip_path='pip3')['azure-cli-core']61# azure-cli-nspkg = host.pip_package.get_packages(pip_path='pip3')['azure-cli-nspkg']62# azure-common = host.pip_package.get_packages(pip_path='pip3')['azure-common']63# azure-mgmt-authorization = host.pip_package.get_packages(pip_path='pip3')['azure-mgmt-authorization']64# azure-mgmt-batch = host.pip_package.get_packages(pip_path='pip3')['azure-mgmt-batch']65# azure-mgmt-cdn = host.pip_package.get_packages(pip_path='pip3')['azure-mgmt-cdn']66# azure-mgmt-compute = host.pip_package.get_packages(pip_path='pip3')['azure-mgmt-compute']67# azure-mgmt-containerinstance = host.pip_package.get_packages(pip_path='pip3')['azure-mgmt-containerinstance']68# azure-mgmt-containerregistry = host.pip_package.get_packages(pip_path='pip3')['azure-mgmt-containerregistry']69# azure-mgmt-containerservice = host.pip_package.get_packages(pip_path='pip3')['azure-mgmt-containerservice']70# azure-mgmt-dns = host.pip_package.get_packages(pip_path='pip3')['azure-mgmt-dns']71# azure-mgmt-keyvault = host.pip_package.get_packages(pip_path='pip3')['azure-mgmt-keyvault']72# azure-mgmt-marketplaceordering = host.pip_package.get_packages(pip_path='pip3')['azure-mgmt-marketplaceordering']73# azure-mgmt-monitor = host.pip_package.get_packages(pip_path='pip3')['azure-mgmt-monitor']74# azure-mgmt-network = host.pip_package.get_packages(pip_path='pip3')['azure-mgmt-network']75# azure-mgmt-nspkg = host.pip_package.get_packages(pip_path='pip3')['azure-mgmt-nspkg']76# azure-mgmt-redis = host.pip_package.get_packages(pip_path='pip3')['azure-mgmt-redis']77# azure-mgmt-resource = host.pip_package.get_packages(pip_path='pip3')['azure-mgmt-resource']78# azure-mgmt-rdbms = host.pip_package.get_packages(pip_path='pip3')['azure-mgmt-rdbms']79# azure-mgmt-servicebus = host.pip_package.get_packages(pip_path='pip3')['azure-mgmt-servicebus']80# azure-mgmt-sql = host.pip_package.get_packages(pip_path='pip3')['azure-mgmt-sql']81# azure-mgmt-storage = host.pip_package.get_packages(pip_path='pip3')['azure-mgmt-storage']82# azure-mgmt-trafficmanager = host.pip_package.get_packages(pip_path='pip3')['azure-mgmt-trafficmanager']83# azure-mgmt-web = host.pip_package.get_packages(pip_path='pip3')['azure-mgmt-web']84# azure-nspkg = host.pip_package.get_packages(pip_path='pip3')['azure-nspkg']85# azure-storage = host.pip_package.get_packages(pip_path='pip3')['azure-storage']86# msrest = host.pip_package.get_packages(pip_path='pip3')['msrest']87# msrestazure = host.pip_package.get_packages(pip_path='pip3')['msrestazure']88# azure-keyvault = host.pip_package.get_packages(pip_path='pip3')['azure-keyvault']89# azure-graphrbac = host.pip_package.get_packages(pip_path='pip3')['azure-graphrbac']90# azure-mgmt-cosmosdb = host.pip_package.get_packages(pip_path='pip3')['azure-mgmt-cosmosdb']91# azure-mgmt-hdinsight = host.pip_package.get_packages(pip_path='pip3')['azure-mgmt-hdinsight']92# azure-mgmt-devtestlabs = host.pip_package.get_packages(pip_path='pip3')['azure-mgmt-devtestlabs']93# azure-mgmt-loganalytics = host.pip_package.get_packages(pip_path='pip3')['azure-mgmt-loganalytics']94# azure-mgmt-automation = host.pip_package.get_packages(pip_path='pip3')['azure-mgmt-automation']95# azure-mgmt-iothub= host.pip_package.get_packages(pip_path='pip3')['azure-mgmt-iothub']96# pyOpenSSL = host.pip_package.get_packages(pip_path='pip3')['pyOpenSSL']97# cryptography = host.pip_package.get_packages(pip_path='pip3')['cryptography']...
setup.py
Source:setup.py
...64 database_legacy.setup.get_package_dir(),65 tko.setup.get_package_dir(),66 utils.setup.get_package_dir(),67 mirror.setup.get_package_dir()])68def get_packages():69 return (client.setup.get_packages() +70 shared.setup.get_packages() +71 frontend.setup.get_packages() +72 cli.setup.get_packages() +73 server.setup.get_packages() +74 scheduler.setup.get_packages() +75 database_legacy.setup.get_packages() +76 tko.setup.get_packages() +77 utils.setup.get_packages() +78 mirror.setup.get_packages() +79 installation_support.setup.get_packages())80def get_data_files():81 return (tko.setup.get_data_files() +82 utils.setup.get_data_files() +83 mirror.setup.get_data_files())84def get_package_data():85 return _combine_dicts([86 _fix_data_paths(client.setup.get_package_data()),87 _fix_data_paths(frontend.setup.get_package_data()),88 _fix_data_paths(cli.setup.get_package_data()),89 _fix_data_paths(server.setup.get_package_data()),90 _fix_data_paths(scheduler.setup.get_package_data()),91 _fix_data_paths(database_legacy.setup.get_package_data()),92 _fix_data_paths(utils.setup.get_package_data())93 ])94def get_scripts():95 return (client.setup.get_scripts() +96 frontend.setup.get_scripts() +97 cli.setup.get_scripts() +98 server.setup.get_scripts() +99 scheduler.setup.get_scripts() +100 database_legacy.setup.get_scripts() +101 tko.setup.get_scripts() +102 installation_support.setup.get_scripts())103def run():104 setup(name='autotest',105 description='Autotest test framework',106 maintainer='Lucas Meneghel Rodrigues',107 maintainer_email='lmr@redhat.com',108 version=version.get_version(),109 url='http://autotest.github.com',110 package_dir=get_package_dir(),111 package_data=get_package_data(),112 packages=get_packages(),113 scripts=get_scripts(),114 data_files=get_data_files(),115 cmdclass=cmdclass,116 command_options=command_options,117 include_package_data=True,118 )119if __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!!