How to use get_test_providers_dir method in autotest

Best Python code snippet using autotest_python

asset.py

Source:asset.py Github

copy

Full Screen

...20 Get the names of all test providers available in test-providers.d.21 :return: List with the names of all test providers.22 """23 provider_name_list = []24 provider_dir = data_dir.get_test_providers_dir()25 for provider in glob.glob(os.path.join(provider_dir, '*.ini')):26 provider_name = os.path.basename(provider).split('.')[0]27 provider_info = get_test_provider_info(provider_name)28 if backend is not None:29 if backend in provider_info['backends']:30 provider_name_list.append(provider_name)31 else:32 provider_name_list.append(provider_name)33 return provider_name_list34def get_test_provider_subdirs(backend=None):35 """36 Get information of all test provider subdirs for a given backend.37 If no backend is provided, return all subdirs with tests.38 :param backend: Backend type, such as 'qemu'.39 :return: List of directories that contain tests for the given backend.40 """41 subdir_list = []42 for provider_name in get_test_provider_names():43 provider_info = get_test_provider_info(provider_name)44 backends_info = provider_info['backends']45 if backend is not None:46 if backend in backends_info:47 subdir_list.append(backends_info[backend]['path'])48 else:49 for b in backends_info:50 subdir_list.append(backends_info[b]['path'])51 return subdir_list52def get_test_provider_info(provider):53 """54 Get a dictionary with relevant test provider info, such as:55 * provider uri (git repo or filesystem location)56 * provider git repo data, such as branch, ref, pubkey57 * backends that this provider has tests for. For each backend type the58 provider has tests for, the 'path' will be also available.59 :param provider: Test provider name, such as 'io-github-autotest-qemu'.60 """61 provider_info = {}62 provider_path = os.path.join(data_dir.get_test_providers_dir(),63 '%s.ini' % provider)64 provider_cfg = test_config.config_loader(provider_path)65 provider_info['name'] = provider66 provider_info['uri'] = provider_cfg.get('provider', 'uri')67 provider_info['branch'] = provider_cfg.get('provider', 'branch', 'master')68 provider_info['ref'] = provider_cfg.get('provider', 'ref')69 provider_info['pubkey'] = provider_cfg.get('provider', 'pubkey')70 provider_info['backends'] = {}71 for backend in get_known_backends():72 subdir = provider_cfg.get(backend, 'subdir')73 if subdir is not None:74 if provider_info['uri'].startswith('file://'):75 src = os.path.join(provider_info['uri'][7:],76 subdir)...

Full Screen

Full Screen

data_dir.py

Source:data_dir.py Github

copy

Full Screen

...99TEST_PROVIDERS_DOWNLOAD_DIR = os.path.join(get_data_dir(), 'test-providers.d',100 'downloads')101def get_base_test_providers_dir():102 return TEST_PROVIDERS_DIR103def get_test_providers_dir():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, "*"))...

Full Screen

Full Screen

Automation Testing Tutorials

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.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run autotest automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful