本文整理汇总了Python中utils.testgen.all_providers函数的典型用法代码示例。如果您正苦于以下问题:Python all_providers函数的具体用法?Python all_providers怎么用?Python all_providers使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了all_providers函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: pytest_generate_tests
def pytest_generate_tests(metafunc):
# Filter out providers without provisioning data or hosts defined
argnames, argvalues, idlist = testgen.all_providers(metafunc)
new_idlist = []
new_argvalues = []
for i, argvalue_tuple in enumerate(argvalues):
args = dict(zip(argnames, argvalue_tuple))
if metafunc.function in {test_vm_genealogy_detected} and args["provider"].type in {"scvmm", "rhevm"}:
continue
new_idlist.append(idlist[i])
new_argvalues.append(argvalues[i])
testgen.parametrize(metafunc, argnames, new_argvalues, ids=new_idlist, scope="module")
示例2: pytest_generate_tests
def pytest_generate_tests(metafunc):
# Filter out providers without templates defined
argnames, argvalues, idlist = testgen.all_providers(metafunc)
# if metafunc.function is not test_ssa_template:
argnames.append('analysis_type')
new_idlist = []
new_argvalues = []
for i, argvalue_tuple in enumerate(argvalues):
args = dict(zip(argnames, argvalue_tuple))
# if metafunc.function is test_ssa_template:
# new_idlist.append(args['provider'].key)
# new_argvalues.append([args["provider"]])
# continue
vms = []
provisioning_data = []
try:
vma_data = args['provider'].data.get('vm_analysis_new', {})
vms = vma_data.get("vms", {})
provisioning_data = vma_data.get("provisioning", {})
except AttributeError:
# Provider has no provisioning and/or vms list set
continue
for vm_analysis_key in vms:
# Each VM can redefine a provisioning data
vm_analysis_data = provisioning_data.copy()
vm_analysis_data.update(vms[vm_analysis_key])
if not {'image', 'fs-type'}.issubset(
vm_analysis_data.viewkeys()):
continue
if vm_analysis_data['fs-type'] not in ['ntfs', 'fat32']:
# Username and password are required for non-windows VMs
if not {'username', 'password'}.issubset(
vm_analysis_data.viewkeys()):
continue
# Set VM name here
new_idlist.append('{}-{}'.format(idlist[i], vm_analysis_key))
new_argvalues.append([args["provider"], vm_analysis_key])
testgen.parametrize(metafunc, argnames, new_argvalues, ids=new_idlist, scope="module")
示例3: pytest_generate_tests
def pytest_generate_tests(metafunc):
# Filter out providers without provisioning data or hosts defined
argnames, argvalues, idlist = testgen.all_providers(metafunc)
new_idlist = []
new_argvalues = []
for i, argvalue_tuple in enumerate(argvalues):
args = dict(zip(argnames, argvalue_tuple))
if args["provider"].type in {"scvmm"}:
continue
if ((metafunc.function is test_action_create_snapshot_and_delete_last) or
(metafunc.function is test_action_create_snapshots_and_delete_them)) \
and args['provider'].type in {"rhevm", "openstack", "ec2"}:
continue
new_idlist.append(idlist[i])
new_argvalues.append(argvalues[i])
testgen.parametrize(metafunc, argnames, new_argvalues, ids=new_idlist, scope="module")
示例4: pytest_generate_tests
def pytest_generate_tests(metafunc):
# Filter out providers without provisioning data or hosts defined
argnames, argvalues, idlist = testgen.all_providers(metafunc,
'small_template', scope="module", template_location=["small_template"])
new_idlist = []
new_argvalues = []
for i, argvalue_tuple in enumerate(argvalues):
args = dict(zip(argnames, argvalue_tuple))
if args["provider_type"] in {"scvmm"}:
continue
if ((metafunc.function is test_action_create_snapshot_and_delete_last)
or
(metafunc.function is test_action_create_snapshots_and_delete_them)) \
and isinstance(args['provider_crud'], RHEVMProvider):
continue
new_idlist.append(idlist[i])
new_argvalues.append(argvalues[i])
testgen.parametrize(metafunc, argnames, new_argvalues, ids=new_idlist, scope="module")
示例5: pytest_generate_tests
def pytest_generate_tests(metafunc):
# Filter out providers without provisioning data or hosts defined
argnames, argvalues, idlist = testgen.all_providers(metafunc)
testgen.parametrize(metafunc, argnames, argvalues, ids=idlist, scope="module")
示例6: pytest_generate_tests
def pytest_generate_tests(metafunc):
argnames, argvalues, idlist = testgen.all_providers(metafunc, required_fields=['ownership_vm'])
testgen.parametrize(metafunc, argnames, argvalues, ids=idlist, scope="module")