Best Python code snippet using autotest_python
asset.py
Source:asset.py
...74 if provider_info['uri'].startswith('file://'):75 src = os.path.join(provider_info['uri'][7:],76 subdir)77 else:78 src = os.path.join(data_dir.get_test_provider_dir(provider),79 subdir)80 provider_info['backends'].update({backend: {'path': src}})81 return provider_info82def download_test_provider(provider, update=False):83 """84 Download a test provider defined on a .ini file inside test-providers.d.85 This function will only download test providers that are in git repos.86 Local filesystems don't need this functionality.87 :param provider: Test provider name, such as 'io-github-autotest-qemu'.88 """89 provider_info = get_test_provider_info(provider)90 uri = provider_info.get('uri')91 if not uri.startswith('file://'):92 uri = provider_info.get('uri')93 branch = provider_info.get('branch')94 ref = provider_info.get('ref')95 pubkey = provider_info.get('pubkey')96 download_dst = data_dir.get_test_provider_dir(provider)97 repo_downloaded = os.path.isdir(os.path.join(download_dst, '.git'))98 original_dir = os.getcwd()99 if not repo_downloaded or update:100 download_dst = git.get_repo(uri=uri, branch=branch, commit=ref,101 destination_dir=download_dst)102 os.chdir(download_dst)103 try:104 utils.run('git remote add origin %s' % uri)105 except error.CmdError:106 pass107 utils.run('git pull origin %s' % branch)108 os.chdir(download_dst)109 utils.system('git log -1')110 os.chdir(original_dir)...
data_dir.py
Source:data_dir.py
...104 """105 Return the base test providers dir (at the moment, test-providers.d).106 """107 return os.path.dirname(TEST_PROVIDERS_DOWNLOAD_DIR)108def get_test_provider_dir(provider):109 """110 Return a specific test providers dir, inside the base dir.111 """112 return os.path.join(TEST_PROVIDERS_DOWNLOAD_DIR, provider)113def clean_tmp_files():114 tmp_dir = get_tmp_dir()115 if os.path.isdir(tmp_dir):116 hidden_paths = glob.glob(os.path.join(tmp_dir, ".??*"))117 paths = glob.glob(os.path.join(tmp_dir, "*"))118 for path in paths + hidden_paths:119 shutil.rmtree(path, ignore_errors=True)120if __name__ == '__main__':121 print "root dir: " + ROOT_DIR122 print "tmp dir: " + get_tmp_dir()...
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!!