本文整理汇总了Python中utils.testgen.provider_by_type函数的典型用法代码示例。如果您正苦于以下问题:Python provider_by_type函数的具体用法?Python provider_by_type怎么用?Python provider_by_type使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了provider_by_type函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: pytest_generate_tests
def pytest_generate_tests(metafunc):
types = ['virtualcenter', 'rhevm', 'scvmm']
argnames, argvalues, idlist = testgen.provider_by_type(
metafunc, types)
argnames = ['providers_for_discover', 'start_ip', 'max_range']
new_id_list = []
providers_complete = []
providers_final = []
for x in idlist:
providers_complete.append(get_crud(x))
provider_combinations = sorted(
find_neighbour_provider_combinations(providers_complete, len(types)), key=len)
signatures_seen = set()
for prov_comb in provider_combinations:
sig = generate_signature(prov_comb)
if sig in signatures_seen:
continue
signatures_seen.add(sig)
start_ip, max_range = minmax_ip(prov_comb)
providers_final.append([prov_comb, start_ip, max_range])
new_id_list.append(sig)
testgen.parametrize(metafunc, argnames, providers_final, ids=new_id_list, scope="module")
开发者ID:akrzos,项目名称:cfme_tests,代码行数:28,代码来源:test_provider_discovery.py
示例2: pytest_generate_tests
def pytest_generate_tests(metafunc):
new_idlist = []
new_argvalues = []
argnames, argvalues, idlist = testgen.provider_by_type(
metafunc, PROVIDER_TYPES, required_fields=['datastores'])
argnames += ['datastore']
for i, argvalue_tuple in enumerate(argvalues):
args = dict(zip(argnames, argvalue_tuple))
datastores = args['provider'].data.get('datastores', {})
if not datastores:
continue
for ds in datastores:
if not ds.get('test_fleece', False):
continue
assert ds.get('type', None) in DATASTORE_TYPES,\
'datastore type must be set to [{}] for smartstate analysis tests'\
.format('|'.join(DATASTORE_TYPES))
argvs = argvalues[i][:]
new_argvalues.append(argvs + [datastore.Datastore(ds['name'], args['provider'].key,
ds['type'])])
test_id = '{}-{}'.format(args['provider'].key, ds['type'])
new_idlist.append(test_id)
testgen.parametrize(metafunc, argnames, new_argvalues, ids=new_idlist, scope="module")
开发者ID:akrzos,项目名称:cfme_tests,代码行数:25,代码来源:test_datastore_analysis.py
示例3: pytest_generate_tests
def pytest_generate_tests(metafunc):
verpicked_prov_types = version.pick(PROVIDER_TYPES)
new_idlist = []
new_argvalues = []
argnames, argvalues, idlist = testgen.provider_by_type(
metafunc, verpicked_prov_types, 'datastores')
argnames += ['datastore_type', 'datastore_name']
for i, argvalue_tuple in enumerate(argvalues):
args = dict(zip(argnames, argvalue_tuple))
if not args['datastores']:
continue
for ds in args['datastores']:
if not ds.get('test_fleece', False):
continue
assert ds.get('type', None) in DATASTORE_TYPES,\
'datastore type must be set to [{}] for smartstate analysis tests'\
.format('|'.join(DATASTORE_TYPES))
argvs = argvalues[i][:]
argvs.pop(argnames.index('datastores'))
new_argvalues.append(argvs + [ds['type'], ds['name']])
test_id = '{}-{}-{}'.format(args['provider'].key, ds['type'], ds['name'])
new_idlist.append(test_id)
argnames.remove('datastores')
metafunc.parametrize(argnames, new_argvalues, ids=new_idlist, scope="module")
开发者ID:amavinag,项目名称:cfme_tests,代码行数:28,代码来源:test_datastore_analysis.py
示例4: pytest_generate_tests
def pytest_generate_tests(metafunc):
argnames, argvalues, idlist = testgen.provider_by_type(metafunc, ['virtualcenter'])
argnames = argnames + ["_host_provider"]
new_idlist = []
new_argvalues = []
for i, argvalue_tuple in enumerate(argvalues):
args = dict(zip(argnames, argvalue_tuple))
if args['provider'].type != "virtualcenter":
continue
hosts = args['provider'].data.get("hosts", [])
if not hosts:
continue
version = args['provider'].data.get("version", None)
if version is None:
# No version, no test
continue
if Version(version) < "5.0":
# Ignore lesser than 5
continue
host = hosts[0]
creds = credentials[host["credentials"]]
ip_address = resolve_hostname(host["name"])
cred = VMwareProvider.Credential(
principal=creds["username"],
secret=creds["password"],
verify_secret=creds["password"]
)
# Mock provider data
provider_data = {}
provider_data.update(args['provider'].data)
provider_data["name"] = host["name"]
provider_data["hostname"] = host["name"]
provider_data["ipaddress"] = ip_address
provider_data["credentials"] = host["credentials"]
provider_data.pop("host_provisioning", None)
provider_data["hosts"] = [host]
provider_data["discovery_range"] = {}
provider_data["discovery_range"]["start"] = ip_address
provider_data["discovery_range"]["end"] = ip_address
host_provider = VMwareProvider(
name=host["name"],
hostname=host["name"],
ip_address=ip_address,
credentials={'default': cred},
provider_data=provider_data,
)
argvalues[i].append(host_provider)
idlist[i] = "{}/{}".format(args['provider'].key, host["name"])
new_idlist.append(idlist[i])
new_argvalues.append(argvalues[i])
testgen.parametrize(metafunc, argnames, new_argvalues, ids=new_idlist, scope="module")
开发者ID:MattLombana,项目名称:cfme_tests,代码行数:56,代码来源:test_esx_direct_host.py
示例5: pytest_generate_tests
def pytest_generate_tests(metafunc):
# Filter out providers without provisioning data or hosts defined
argnames, argvalues, idlist = testgen.provider_by_type(metafunc, ['rhevm'],
required_fields=[
['provisioning', 'ci-template'],
['provisioning', 'ci-username'],
['provisioning', 'ci-pass'],
['provisioning', 'image']
])
testgen.parametrize(metafunc, argnames, argvalues, ids=idlist, scope="module")
开发者ID:FilipB,项目名称:cfme_tests,代码行数:10,代码来源:test_cloud_init_provisioning.py
示例6: pytest_generate_tests
def pytest_generate_tests(metafunc):
# Filter out providers not meant for Chargeback Testing
argnames, argvalues, idlist = testgen.provider_by_type(metafunc, ['virtualcenter', 'rhevm'],
required_fields=[(['cap_and_util', 'test_chargeback'], True)]
)
new_argvalues = []
new_idlist = []
for i, argvalue_tuple in enumerate(argvalues):
new_idlist.append(idlist[i])
new_argvalues.append(argvalues[i])
testgen.parametrize(metafunc, argnames, new_argvalues, ids=new_idlist, scope="module")
开发者ID:ManageIQ,项目名称:integration_tests,代码行数:14,代码来源:test_validate_chargeback_report.py
示例7: pytest_generate_tests
def pytest_generate_tests(metafunc):
final_argv, final_ids = [], []
# Get all providers and pick those, that have power control test enabled
argnames, argvalues, idlist = testgen.provider_by_type(
metafunc, ['ec2', 'openstack'], 'test_power_control')
for argn, argv, single_id in zip(argnames, argvalues, idlist):
test_pwr_ctl_i = argnames.index('test_power_control')
provider = argnames.index('provider')
if argv[test_pwr_ctl_i] is True:
final_argv.append(argv)
final_ids.append(argv[provider].key)
testgen.parametrize(metafunc, argnames, final_argv, ids=final_ids, scope="function")
开发者ID:prachiyadav,项目名称:cfme_tests,代码行数:15,代码来源:test_instance_power_control.py
示例8: pytest_generate_tests
def pytest_generate_tests(metafunc):
# Filter out providers without templates defined
argnames, argvalues, idlist = testgen.provider_by_type(metafunc, 'ec2', 'provisioning')
new_argvalues = []
new_idlist = []
for i, argvalue_tuple in enumerate(argvalues):
args = dict(zip(argnames, argvalue_tuple))
if not args['provisioning']:
# Don't know what type of instance to provision, move on
continue
# required keys should be a subset of the dict keys set
if not {'image'}.issubset(args['provisioning'].viewkeys()):
# Need image for image -> instance provisioning
continue
new_idlist.append(idlist[i])
new_argvalues.append([args[argname] for argname in argnames])
testgen.parametrize(metafunc, argnames, new_argvalues, ids=new_idlist, scope="module")
开发者ID:jkrocil,项目名称:cfme_tests,代码行数:21,代码来源:test_ec2_service_catalogs.py
示例9: pytest_generate_tests
def pytest_generate_tests(metafunc):
p_argn, p_argv, p_ids = testgen.provider_by_type(metafunc, PROVIDER_TYPES, 'datastores')
argnames = ['provider_key', 'datastore_type', 'datastore_name']
argvalues = []
idlist = []
for argv in p_argv:
prov_datastores, prov_key = argv[0], argv[1]
if not prov_datastores:
continue
for test_datastore in prov_datastores:
if not test_datastore.get('test_fleece', False):
continue
assert test_datastore.get('type', None) in DATASTORE_TYPES,\
'datastore type must be set to [{}] for smartstate analysis tests'\
.format('|'.join(DATASTORE_TYPES))
argvalues.append([prov_key, test_datastore['type'], test_datastore['name']])
test_id = '{}-{}-{}'.format(prov_key, test_datastore['type'], test_datastore['name'])
idlist.append(test_id)
metafunc.parametrize(argnames, argvalues, ids=idlist, scope="module")
开发者ID:jkrocil,项目名称:cfme_tests,代码行数:21,代码来源:test_datastore_analysis.py
示例10: pytest_generate_tests
def pytest_generate_tests(metafunc):
# Filter out providers not meant for Chargeback Testing
argnames, argvalues, idlist = testgen.provider_by_type(metafunc, ['virtualcenter', 'rhevm'],
required_fields=[(['cap_and_util', 'test_chargeback'], True)]
)
new_argvalues = []
new_idlist = []
for i, argvalue_tuple in enumerate(argvalues):
args = dict(zip(argnames, argvalue_tuple))
capandu_data = args['provider'].data['cap_and_util']
stream = capandu_data.get('chargeback_runs_on_stream', '')
if not version.current_version().is_in_series(str(stream)):
continue
new_idlist.append(idlist[i])
new_argvalues.append(argvalues[i])
testgen.parametrize(metafunc, argnames, new_argvalues, ids=new_idlist, scope="module")
开发者ID:RonnyPfannschmidt,项目名称:cfme_tests,代码行数:21,代码来源:test_validate_chargeback_report.py
示例11: pytest_generate_tests
def pytest_generate_tests(metafunc):
argnames, argvalues, idlist = testgen.provider_by_type(
metafunc, ['virtualcenter'], choose_random=True)
if not idlist:
return
new_idlist = []
new_argvalues = []
if 'random_pwr_ctl_vm' in metafunc.fixturenames:
if random_vm_test:
argnames, new_argvalues, new_idlist = random_vm_test
else:
single_index = random.choice(range(len(idlist)))
new_idlist = ['random_provider']
new_argvalues = argvalues[single_index]
argnames.append('random_pwr_ctl_vm')
new_argvalues.append('')
new_argvalues = [new_argvalues]
random_vm_test.append(argnames)
random_vm_test.append(new_argvalues)
random_vm_test.append(new_idlist)
else:
new_idlist = idlist
new_argvalues = argvalues
metafunc.parametrize(argnames, argvalues, ids=idlist, scope='module')
开发者ID:pombredanne,项目名称:cfme_tests,代码行数:24,代码来源:test_appliance_replication.py
示例12: pytest_generate_tests
def pytest_generate_tests(metafunc):
argnames, argvalues, idlist = testgen.provider_by_type(
metafunc, ['virtualcenter'], 'provisioning')
metafunc.parametrize(argnames, argvalues, ids=idlist, scope='module')
开发者ID:seandst,项目名称:cfme_tests,代码行数:4,代码来源:test_vmware_methods.py
示例13: pytest_generate_tests
def pytest_generate_tests(metafunc):
argnames, argvalues, idlist = testgen.provider_by_type(
metafunc, ['azure', 'ec2', 'openstack'], required_fields=[('test_power_control', True)])
testgen.parametrize(metafunc, argnames, argvalues, ids=idlist, scope="function")
开发者ID:anewmanRH,项目名称:cfme_tests,代码行数:4,代码来源:test_instance_power_control.py
示例14: pytest_generate_tests
def pytest_generate_tests(metafunc):
argnames, argvalues, idlist = testgen.provider_by_type(metafunc, ['virtualcenter', 'rhevm'])
testgen.parametrize(metafunc, argnames, argvalues, ids=idlist, scope="module")
开发者ID:ManageIQ,项目名称:integration_tests,代码行数:3,代码来源:test_timelines.py
示例15: pytest_generate_tests
def pytest_generate_tests(metafunc):
argnames, argvalues, idlist = testgen.provider_by_type(metafunc, ["ec2"], "provisioning")
metafunc.parametrize(argnames, argvalues, ids=idlist, scope="module")
开发者ID:seandst,项目名称:cfme_tests,代码行数:3,代码来源:test_stack.py
示例16: pytest_generate_tests
def pytest_generate_tests(metafunc):
argnames, argvalues, idlist = testgen.provider_by_type(
metafunc, ['virtualcenter', 'rhevm', 'ec2', 'rhos'],
required_fields=[['cap_and_util', 'chargeback_vm']])
testgen.parametrize(metafunc, argnames, argvalues, ids=idlist, scope="module")
开发者ID:patchkez,项目名称:cfme_tests,代码行数:5,代码来源:test_utilization_metrics.py
示例17: pytest_generate_tests
def pytest_generate_tests(metafunc):
argnames, argvalues, idlist = testgen.provider_by_type(
metafunc, ['openstack'])
testgen.parametrize(metafunc, argnames, argvalues, ids=idlist, scope='module')
开发者ID:RonnyPfannschmidt,项目名称:cfme_tests,代码行数:4,代码来源:test_keypairs.py
示例18: pytest_generate_tests
def pytest_generate_tests(metafunc):
argnames, argvalues, idlist = testgen.provider_by_type(
metafunc, ['ec2', 'openstack', 'azure', 'gce'],
required_fields=[(['cap_and_util', 'capandu_vm'], 'cu-24x7')])
testgen.parametrize(metafunc, argnames, argvalues, ids=idlist, scope="module")
开发者ID:RonnyPfannschmidt,项目名称:cfme_tests,代码行数:5,代码来源:test_utilization_metrics.py
示例19: pytest_generate_tests
def pytest_generate_tests(metafunc):
argnames, argvalues, idlist = testgen.provider_by_type(
metafunc, ['virtualcenter'], required_fields=[['provisioning', 'template']])
testgen.parametrize(metafunc, argnames, argvalues, ids=idlist, scope='module')
开发者ID:MattLombana,项目名称:cfme_tests,代码行数:4,代码来源:test_vmware_methods.py
示例20: pytest_generate_tests
def pytest_generate_tests(metafunc):
argnames, argvalues, idlist = testgen.provider_by_type(
metafunc, ['scvmm'], 'small_template')
testgen.parametrize(metafunc, argnames, argvalues, ids=idlist, scope='module')
开发者ID:pombredanne,项目名称:cfme_tests,代码行数:4,代码来源:test_scvmm_specific.py
注:本文中的utils.testgen.provider_by_type函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论