当前位置: 首页>>代码示例>>Python>>正文


Python testgen.infra_providers函数代码示例

本文整理汇总了Python中utils.testgen.infra_providers函数的典型用法代码示例。如果您正苦于以下问题:Python infra_providers函数的具体用法?Python infra_providers怎么用?Python infra_providers使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了infra_providers函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: pytest_generate_tests

def pytest_generate_tests(metafunc):
    # Filter out providers without provisioning data or hosts defined
    argnames, argvalues, idlist = testgen.infra_providers(
        metafunc,
        required_fields=[["provisioning", "template"], ["provisioning", "host"], ["provisioning", "datastore"]],
    )
    testgen.parametrize(metafunc, argnames, argvalues, ids=idlist, scope="module")
开发者ID:ManageIQ,项目名称:integration_tests,代码行数:7,代码来源:test_vm_clone.py

示例2: pytest_generate_tests

def pytest_generate_tests(metafunc):
    # Filter out providers without provisioning data or hosts defined
    argnames, argvalues, idlist = testgen.infra_providers(metafunc, 'provisioning')
    argnames = argnames + ['cloud_init_template']

    new_idlist = []
    new_argvalues = []
    for i, argvalue_tuple in enumerate(argvalues):
        args = dict(zip(argnames, argvalue_tuple))
        if not args['provisioning']:
            # No provisioning data available
            continue

        if args['provider_type'] == "scvmm" or args['provider_type'] == 'virtualcenter':
            continue

        # required keys should be a subset of the dict keys set
        if not {'ci-template', 'ci-username', 'ci-pass', 'template'}.issubset(
                args['provisioning'].viewkeys()):
            continue

        cloud_init_template = args['provisioning']['ci-template']
        if cloud_init_template not in cfme_data.get('customization_templates', {}).keys():
            continue

        argvalues[i].append(get_template_from_config(cloud_init_template))

        new_idlist.append(idlist[i])
        new_argvalues.append(argvalues[i])

    testgen.parametrize(metafunc, argnames, new_argvalues, ids=new_idlist, scope="module")
开发者ID:seandst,项目名称:cfme_tests,代码行数:31,代码来源:test_cloud_init_provisioning.py

示例3: pytest_generate_tests

def pytest_generate_tests(metafunc):
    argnames, argvalues, idlist = testgen.infra_providers(metafunc)
    argnames = argnames + ['host_type', 'host_name']
    new_argvalues = []
    new_idlist = []

    for i, argvalue_tuple in enumerate(argvalues):
        args = dict(zip(argnames, argvalue_tuple))

        prov_hosts = args['provider'].data['hosts']

        if not prov_hosts:
            continue
        for test_host in prov_hosts:
            if not test_host.get('test_fleece', False):
                continue
            assert test_host.get('type', None) in HOST_TYPES,\
                'host type must be set to [{}] for smartstate analysis tests'\
                .format('|'.join(HOST_TYPES))

            argvalues[i] = argvalues[i] + [test_host['type'], test_host['name']]
            test_id = '{}-{}-{}'.format(args['provider'].key, test_host['type'], test_host['name'])
            idlist.append(test_id)
            new_argvalues.append(argvalues[i])
            new_idlist.append(test_id)
    metafunc.parametrize(argnames, new_argvalues, ids=new_idlist, scope="module")
开发者ID:sakthivelramakrishnan,项目名称:cfme_tests,代码行数:26,代码来源:test_host_analysis.py

示例4: pytest_generate_tests

def pytest_generate_tests(metafunc):
    # Filter out providers without provisioning data or hosts defined
    argnames, argvalues, idlist = testgen.infra_providers(metafunc, required_fields=[
        'iso_datastore',
        ['provisioning', 'host'],
        ['provisioning', 'datastore'],
        ['provisioning', 'iso_template'],
        ['provisioning', 'iso_file'],
        ['provisioning', 'iso_kickstart'],
        ['provisioning', 'iso_root_password'],
        ['provisioning', 'iso_image_type'],
        ['provisioning', 'vlan'],
    ])
    argnames = argnames + ['iso_cust_template', 'iso_datastore']

    new_idlist = []
    new_argvalues = []
    for i, argvalue_tuple in enumerate(argvalues):
        args = dict(zip(argnames, argvalue_tuple))

        iso_cust_template = args['provider'].data['provisioning']['iso_kickstart']
        if iso_cust_template not in cfme_data.get('customization_templates', {}).keys():
            continue

        argvalues[i].append(get_template_from_config(iso_cust_template))
        argvalues[i].append(ISODatastore(args['provider'].name))
        new_idlist.append(idlist[i])
        new_argvalues.append(argvalues[i])

    testgen.parametrize(metafunc, argnames, new_argvalues, ids=new_idlist, scope="module")
开发者ID:akrzos,项目名称:cfme_tests,代码行数:30,代码来源:test_iso_service_catalogs.py

示例5: pytest_generate_tests

def pytest_generate_tests(metafunc):
    # Filter out providers without provisioning data or hosts defined
    argnames, argvalues, idlist = testgen.infra_providers(metafunc)
    if not idlist:
        return
    new_idlist = []
    new_argvalues = []
    if 'random_pwr_ctl_vm' in metafunc.fixturenames:
        if random_vm_test:
            # Reusing random vm for test
            argnames, new_argvalues, new_idlist = random_vm_test
        else:
            # Picking random VM for tests
            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
    testgen.parametrize(metafunc, argnames, new_argvalues, ids=new_idlist, scope="class")
开发者ID:MattLombana,项目名称:cfme_tests,代码行数:26,代码来源:test_vm_power_control.py

示例6: pytest_generate_tests

def pytest_generate_tests(metafunc):
    # Filter out providers without provisioning data or hosts defined
    argnames, argvalues, idlist = testgen.infra_providers(metafunc, 'provider_key')
    for i, argvalue_tuple in enumerate(argvalues):
        provider_data = cfme_data['management_systems'][
            argvalue_tuple[argnames.index('provider_key')]]
        if provider_data.get('type', False) != 'virtualcenter':
            continue

    if 'random_snpsht_mgt_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 = [idlist[single_index]]
            new_argvalues = argvalues[single_index]
            argnames.append('random_snpsht_mgt_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
    testgen.parametrize(metafunc, argnames, new_argvalues, ids=new_idlist, scope="module")
开发者ID:slouderm,项目名称:cfme_tests,代码行数:26,代码来源:test_snapshot.py

示例7: pytest_generate_tests

def pytest_generate_tests(metafunc):
    # Filter out providers without provisioning data or hosts defined
    argnames, argvalues, idlist = testgen.infra_providers(
        metafunc, 'provisioning', template_location=["provisioning", "template"])

    new_idlist = []
    new_argvalues = []
    for i, argvalue_tuple in enumerate(argvalues):
        args = dict(zip(argnames, argvalue_tuple))
        if not args['provisioning']:
            # No provisioning data available
            continue

        if args['provider'].type == "scvmm":
            continue

        # required keys should be a subset of the dict keys set
        if not {'template', 'host', 'datastore'}.issubset(args['provisioning'].viewkeys()):
            # Need all three for template provisioning
            continue

        new_idlist.append(idlist[i])
        new_argvalues.append(argvalues[i])

    testgen.parametrize(metafunc, argnames, new_argvalues, ids=new_idlist, scope="module")
开发者ID:richardfontana,项目名称:cfme_tests,代码行数:25,代码来源:test_provisioning.py

示例8: pytest_generate_tests

def pytest_generate_tests(metafunc):
    # Filter out providers without provisioning data or hosts defined
    argnames, argvalues, idlist = testgen.infra_providers(metafunc,
        required_fields=[
            ['provisioning', 'template'],
            ['provisioning', 'host'],
            ['provisioning', 'datastore']
        ])
    testgen.parametrize(metafunc, argnames, argvalues, ids=idlist, scope="module")
开发者ID:sakthivelramakrishnan,项目名称:cfme_tests,代码行数:9,代码来源:test_provisioning_dialog.py

示例9: pytest_generate_tests

def pytest_generate_tests(metafunc):
    # cfme.rest.services requires several provisioning tags
    argnames, argvalues, idlist = testgen.infra_providers(
        metafunc,
        required_fields=[['provisioning', 'template'],
                         ['provisioning', 'host'],
                         ['provisioning', 'datastore'],
                         ['provisioning', 'iso_file'],
                         ['provisioning', 'vlan'],
                         ['provisioning', 'catalog_item_type']])
    testgen.parametrize(metafunc, argnames, argvalues, ids=idlist, scope='module')
开发者ID:ManageIQ,项目名称:integration_tests,代码行数:11,代码来源:test_rest_services.py

示例10: pytest_generate_tests

def pytest_generate_tests(metafunc):
    argnames, argvalues, idlist = testgen.infra_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

        new_idlist.append(idlist[i])
        new_argvalues.append(argvalues[i])

    testgen.parametrize(metafunc, argnames, new_argvalues, ids=new_idlist, scope="module")
开发者ID:FilipB,项目名称:cfme_tests,代码行数:14,代码来源:test_alerts.py

示例11: pytest_generate_tests

def pytest_generate_tests(metafunc):
    # Filter out providers without host provisioning data defined
    argnames, argvalues, idlist = testgen.infra_providers(metafunc, required_fields=[
        ['host_provisioning', 'pxe_server'],
        ['host_provisioning', 'pxe_image'],
        ['host_provisioning', 'pxe_image_type'],
        ['host_provisioning', 'pxe_kickstart'],
        ['host_provisioning', 'datacenter'],
        ['host_provisioning', 'cluster'],
        ['host_provisioning', 'datastores'],
        ['host_provisioning', 'hostname'],
        ['host_provisioning', 'root_password'],
        ['host_provisioning', 'ip_addr'],
        ['host_provisioning', 'subnet_mask'],
        ['host_provisioning', 'gateway'],
        ['host_provisioning', 'dns'],
    ])
    pargnames, pargvalues, pidlist = testgen.pxe_servers(metafunc)
    argnames = argnames + ['pxe_server', 'pxe_cust_template']
    pxe_server_names = [pval[0] for pval in pargvalues]

    new_idlist = []
    new_argvalues = []
    for i, argvalue_tuple in enumerate(argvalues):
        args = dict(zip(argnames, argvalue_tuple))
        try:
            prov_data = args['provider'].data['host_provisioning']
        except KeyError:
            # No host provisioning data available
            continue

        stream = prov_data.get('runs_on_stream', '')
        if not version.current_version().is_in_series(str(stream)):
            continue

        pxe_server_name = prov_data.get('pxe_server', '')
        if pxe_server_name not in pxe_server_names:
            continue

        pxe_cust_template = prov_data.get('pxe_kickstart', '')
        if pxe_cust_template not in cfme_data.get('customization_templates', {}).keys():
            continue

        argvalues[i].append(get_pxe_server_from_config(pxe_server_name))
        argvalues[i].append(get_template_from_config(pxe_cust_template))
        new_idlist.append(idlist[i])
        new_argvalues.append(argvalues[i])

    testgen.parametrize(metafunc, argnames, new_argvalues, ids=new_idlist, scope="module")
开发者ID:FilipB,项目名称:cfme_tests,代码行数:49,代码来源:test_host_provisioning.py

示例12: pytest_generate_tests

def pytest_generate_tests(metafunc):
    # Filter out providers without provisioning data or hosts defined
    argnames, argvalues, idlist = testgen.infra_providers(metafunc, "iso_datastore")

    new_idlist = []
    new_argvalues = []
    for i, argvalue_tuple in enumerate(argvalues):
        args = dict(zip(argnames, argvalue_tuple))
        if not args["iso_datastore"]:
            # No provisioning data available
            continue

        new_idlist.append(idlist[i])
        new_argvalues.append(argvalues[i])

    testgen.parametrize(metafunc, argnames, new_argvalues, ids=new_idlist, scope="module")
开发者ID:seandst,项目名称:cfme_tests,代码行数:16,代码来源:test_iso_datastore.py

示例13: pytest_generate_tests

def pytest_generate_tests(metafunc):
    # Filter out providers without multiple hosts defined
    argnames, argvalues, idlist = testgen.infra_providers(metafunc, required_fields=["hosts"])

    new_argvalues = []
    new_idlist = []
    for i, argvalue_tuple in enumerate(argvalues):
        args = dict(zip(argnames, argvalue_tuple))
        hosts = args['provider'].data.get('hosts', {})

        if len(hosts) < 2:
            continue

        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,代码行数:17,代码来源:test_host.py

示例14: pytest_generate_tests

def pytest_generate_tests(metafunc):
    p_argn, p_argv, p_ids = testgen.infra_providers(metafunc, "hosts")
    argnames = ["provider_key", "host_type", "host_name"]
    argvalues = []
    idlist = []
    for argv in p_argv:
        prov_hosts, prov_key = argv[0], argv[1]
        if not prov_hosts:
            continue
        for test_host in prov_hosts:
            if not test_host.get("test_fleece", False):
                continue

            argvalues.append([prov_key, test_host["type"], test_host["name"]])
            test_id = "{}-{}-{}".format(prov_key, test_host["type"], test_host["name"])
            idlist.append(test_id)

    testgen.parametrize(metafunc, argnames, argvalues, ids=idlist, scope="module")
开发者ID:seandst,项目名称:cfme_tests,代码行数:18,代码来源:test_host_drift_analysis.py

示例15: pytest_generate_tests

def pytest_generate_tests(metafunc):
    # Filter out providers without provisioning data or hosts defined
    argnames, argvalues, idlist = testgen.infra_providers(metafunc, "provisioning")
    argnames = argnames + ["iso_cust_template", "iso_datastore"]

    new_idlist = []
    new_argvalues = []
    for i, argvalue_tuple in enumerate(argvalues):
        args = dict(zip(argnames, argvalue_tuple))
        if not args["provisioning"]:
            # No provisioning data available
            continue

        if args["provider_type"] == "scvmm":
            continue

        provider_data = cfme_data.get("management_systems", {})[argvalue_tuple[argnames.index("provider_key")]]
        if not provider_data.get("iso_datastore", False):
            continue

        # required keys should be a subset of the dict keys set
        if not {
            "iso_template",
            "host",
            "datastore",
            "iso_file",
            "iso_kickstart",
            "iso_root_password",
            "iso_image_type",
            "vlan",
        }.issubset(args["provisioning"].viewkeys()):
            # Need all  for template provisioning
            continue

        iso_cust_template = args["provisioning"]["iso_kickstart"]
        if iso_cust_template not in cfme_data.get("customization_templates", {}).keys():
            continue

        argvalues[i].append(get_template_from_config(iso_cust_template))
        argvalues[i].append(ISODatastore(provider_data["name"]))
        new_idlist.append(idlist[i])
        new_argvalues.append(argvalues[i])

    testgen.parametrize(metafunc, argnames, new_argvalues, ids=new_idlist, scope="module")
开发者ID:seandst,项目名称:cfme_tests,代码行数:44,代码来源:test_iso_provisioning.py


注:本文中的utils.testgen.infra_providers函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。