• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python testgen.generate函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: VMWrapper

from cfme.cloud.provider.openstack import OpenStackProvider
from cfme.cloud.provider.azure import AzureProvider
from cfme import test_requirements
from utils import conf, testgen
from utils.blockers import BZ
from utils.generators import random_vm_name
from utils.hosts import setup_host_creds
from utils.log import logger
from utils.pretty import Pretty
from utils.update import update
from utils.virtual_machines import deploy_template
from utils.wait import wait_for, TimedOutError
from . import do_scan, wait_for_ssa_enabled


pytest_generate_tests = testgen.generate(gen_func=testgen.all_providers, scope="module")

pytestmark = [
    pytest.mark.long_running,
    pytest.mark.meta(blockers=[
        BZ(
            1149128,
            unblock=lambda provider: not provider.one_of(SCVMMProvider))
    ]),
    pytest.mark.meta(server_roles="+automate +smartproxy +smartstate"),
    pytest.mark.tier(2),
    test_requirements.control
]


class VMWrapper(Pretty):
开发者ID:dajohnso,项目名称:cfme_tests,代码行数:31,代码来源:test_actions.py


示例2: test_host_role_association

import pytest
from random import choice
from selenium.common.exceptions import NoSuchElementException

from cfme.configure.tasks import is_host_analysis_finished
from cfme.infrastructure.deployment_roles import DeploymentRoles
from cfme.infrastructure.host import Host
from cfme.infrastructure.provider.openstack_infra import OpenstackInfraProvider
from cfme.web_ui import flash, Quadicon, summary_title, toolbar
from utils import testgen
from utils.appliance.implementations.ui import navigate_to
from utils.wait import wait_for


pytest_generate_tests = testgen.generate([OpenstackInfraProvider],
                                         scope='module')
pytestmark = [pytest.mark.usefixtures("setup_provider_modscope")]


ROLES = ['NovaCompute', 'Controller', 'Compute', 'BlockStorage', 'SwiftStorage',
         'CephStorage']


def test_host_role_association(provider, soft_assert):
    navigate_to(provider, 'ProviderNodes')
    names = [q.name for q in list(Quadicon.all())]
    for node in names:
        host = Host(node, provider=provider)
        host.run_smartstate_analysis()
        wait_for(is_host_analysis_finished, [host.name], delay=15,
                 timeout="10m", fail_func=toolbar.refresh)
开发者ID:dajohnso,项目名称:cfme_tests,代码行数:31,代码来源:test_roles.py


示例3: current_version

import pytest
import random

from cfme.web_ui import CheckboxTable
from cfme.containers.replicator import Replicator
from utils import testgen
from utils.appliance.implementations.ui import navigate_to
from utils.version import current_version


pytestmark = [
    pytest.mark.uncollectif(lambda provider: current_version() < "5.6" and provider.version > 3.2),
    pytest.mark.usefixtures('setup_provider'),
    pytest.mark.tier(1)]
pytest_generate_tests = testgen.generate(
    testgen.container_providers, scope='module')

list_tbl = CheckboxTable(table_locator="//div[@id='list_grid']//table")


REPLICATORS_PROPERTIES_FIELDS = ['Name', 'Creation timestamp', 'Resource version',
                                 'Requested pods', 'Current pods']
REPLICATORS_RELATIONSHIPS_FIELDS = ['Containers Provider', 'Project', 'Pods', 'Nodes',
                                    'My Company Tags']


@pytest.fixture(scope="module")
def replicator(provider):
    navigate_to(Replicator, 'All')
    replicator_name = random.choice([r.name.text for r in list_tbl.rows()])
    return Replicator(replicator_name, provider)
开发者ID:ManageIQ,项目名称:integration_tests,代码行数:31,代码来源:test_containers_default_project_replicators.py


示例4: current_version

import pytest
from cfme.middleware.server import MiddlewareServer
from utils import testgen
from utils.version import current_version

pytestmark = [
    pytest.mark.usefixtures('setup_provider'),
    pytest.mark.uncollectif(lambda: current_version() < '5.7'),
]
pytest_generate_tests = testgen.generate(testgen.provider_by_type, ["hawkular"], scope="function")


def test_list_servers():
    """Tests servers lists between UI, DB and Management system.

    Steps:
        * Get servers list from UI
        * Get servers list from Database
        * Get headers from UI
        * Compare headers from UI with expected headers list
        * Compare content of all the list [UI, Database, Management system]
    """
    ui_servers = _get_servers_set(MiddlewareServer.servers())
    db_servers = _get_servers_set(MiddlewareServer.servers_in_db())
    mgmt_servers = _get_servers_set(MiddlewareServer.servers_in_mgmt())
    headers = MiddlewareServer.headers()
    headers_expected = ['Server Name', 'Product', 'Host Name', 'Feed', 'Provider']
    assert headers == headers_expected
    assert ui_servers == db_servers == mgmt_servers, \
        ("Lists of servers mismatch! UI:{}, DB:{}, MGMT:{}"
         .format(ui_servers, db_servers, mgmt_servers))
开发者ID:jistefan,项目名称:cfme_tests,代码行数:31,代码来源:test_middleware_server.py


示例5: a_provider

"""This module contains REST API specific tests."""
import fauxfactory
import pytest

from cfme import Credential
from cfme.configure.access_control import User, Group
from cfme.login import login
from cfme.rest import vm as _vm
from utils.providers import setup_a_provider as _setup_a_provider
from utils.version import current_version
from utils import testgen, conf, version


pytest_generate_tests = testgen.generate(
    testgen.provider_by_type,
    ['virtualcenter', 'rhevm'],
    scope="module"
)


@pytest.fixture(scope="module")
def a_provider():
    return _setup_a_provider("infra")


@pytest.mark.usefixtures("logged_in")
@pytest.fixture(scope='function')
def user():
    user = User(credential=Credential(principal=fauxfactory.gen_alphanumeric(),
        secret=fauxfactory.gen_alphanumeric()), name=fauxfactory.gen_alphanumeric(),
        group=Group(description='EvmGroup-super_administrator'))
开发者ID:MattLombana,项目名称:cfme_tests,代码行数:31,代码来源:test_rest.py


示例6: current_version

from cfme.middleware.provider.hawkular import HawkularProvider
from cfme.middleware.server import MiddlewareServer
from cfme.web_ui import flash
from utils import testgen
from utils.version import current_version
from server_methods import verify_server_running, verify_server_stopped
from server_methods import get_servers_set, verify_server_suspended
from server_methods import get_eap_server, get_hawkular_server
from server_methods import verify_server_starting, verify_server_stopping
from server_methods import get_eap_container_server

pytestmark = [
    pytest.mark.usefixtures('setup_provider'),
    pytest.mark.uncollectif(lambda: current_version() < '5.7'),
]
pytest_generate_tests = testgen.generate([HawkularProvider], scope="function")


@pytest.yield_fixture(scope="function")
def server(provider):
    server = get_eap_server(provider)
    yield server
    server.restart_server()


def test_list_servers():
    """Tests servers lists between UI, DB and Management system.

    Steps:
        * Get servers list from UI
        * Get servers list from Database
开发者ID:dajohnso,项目名称:cfme_tests,代码行数:31,代码来源:test_middleware_server.py


示例7: tenant

# -*- coding: utf-8 -*-
import fauxfactory
import pytest

from cfme.cloud.tenant import Tenant
from utils import testgen

pytest_generate_tests = testgen.generate(testgen.provider_by_type, ["openstack"], scope="module")


@pytest.fixture
def tenant(provider_key):
    return Tenant(
        name=fauxfactory.gen_alphanumeric(8), description=fauxfactory.gen_alphanumeric(8), provider_key=provider_key
    )


def test_tenant(provider_mgmt, tenant, provider_key):
    """ Tests tenant (currently disabled)

    Metadata:
        test_flag: tenant
    """
    print tenant.name, tenant.description, provider_key
开发者ID:seandst,项目名称:cfme_tests,代码行数:24,代码来源:test_tenant.py


示例8: generate

import pytest

from cfme.infrastructure import pxe
from utils.update import update
from utils.testgen import generate, pxe_servers


pytest_generate_tests = generate(pxe_servers)


@pytest.fixture(scope='function')
def has_no_pxe_servers():
    pxe.remove_all_pxe_servers()


@pytest.mark.usefixtures('has_no_pxe_servers')
def test_pxe_server_crud(pxe_name, pxe_server_crud):
    """
    Basic Add test for PXE server including refresh.
    """
    pxe_server_crud.create()
    with update(pxe_server_crud):
        pxe_server_crud.name = pxe_server_crud.name + "_update"
    pxe_server_crud.delete(cancel=False)
开发者ID:jkrocil,项目名称:cfme_tests,代码行数:24,代码来源:test_pxe.py


示例9: test_credentials_quads

import pytest
from utils import testgen
from cfme.web_ui import Quadicon
from cfme.fixtures import pytest_selenium as sel


pytest_generate_tests = testgen.generate(testgen.provider_by_type,
                                         ['openstack-infra'],
                                         scope='module')


@pytest.mark.usefixtures("setup_provider_modscope")
def test_credentials_quads(provider):
    provider.load_details()
    sel.force_navigate("infrastructure_providers")
    quad = Quadicon(provider.name, qtype='infra_prov')
    checked = str(quad.creds).split('-')[0]
    assert checked == 'checkmark'
开发者ID:FilipB,项目名称:cfme_tests,代码行数:18,代码来源:test_credentials_quad.py


示例10: vm_name

from cfme.automate.simulation import simulate
from cfme.common.vm import VM
from cfme.fixtures import pytest_selenium as sel
from cfme.infrastructure.virtual_machines import Vm  # For Vm.Snapshot
from utils import testgen
from utils.conf import credentials
from utils.log import logger
from utils.path import data_path
from utils.ssh import SSHClient
from utils.wait import wait_for


pytestmark = [pytest.mark.long_running]


pytest_generate_tests = testgen.generate(testgen.infra_providers, 'full_template', scope="module")


@pytest.fixture(scope="module")
def vm_name():
    return "test_snpsht_" + fauxfactory.gen_alphanumeric()


@pytest.fixture(scope="module")
def domain(request):
    dom = Domain(fauxfactory.gen_alpha(), enabled=True)
    dom.create()
    request.addfinalizer(dom.delete)
    return dom

开发者ID:pombredanne,项目名称:cfme_tests,代码行数:29,代码来源:test_snapshot.py


示例11: enable_candu

from cfme.middleware.provider import MiddlewareProvider
from cfme.exceptions import FlashMessageException
from utils import providers
from utils import testgen
from utils import conf
from utils.log import logger
from utils.version import current_version


# Tests for vmware,rhev, openstack, ec2, azure, gce providers have been moved to
# cfme/tests/test_utilization_metrics.py.
# Also, this test just verifies that C&U/perf data is being collected, whereas the tests in
# test_utilization_metrics.py go a step further and verify that specific performance metrics are
# being collected.Eventually, support should be added to verify that specific metrics are being
# collected for *all* providers.
pytest_generate_tests = testgen.generate([ContainersProvider, MiddlewareProvider], scope="module")


pytestmark = [
    pytest.mark.tier(1),
    test_requirements.c_and_u
]


@pytest.yield_fixture(scope="module")
def enable_candu():
    try:
        with server_roles_enabled(
                'ems_metrics_coordinator', 'ems_metrics_collector', 'ems_metrics_processor'):
            candu.enable_all()
            yield
开发者ID:rananda,项目名称:cfme_tests,代码行数:31,代码来源:test_utilization.py


示例12: create_report

from cfme import test_requirements
from cfme.cloud.provider.ec2 import EC2Provider
from cfme.cloud.provider.openstack import OpenStackProvider
from cfme.infrastructure.provider.rhevm import RHEVMProvider
from cfme.infrastructure.provider.virtualcenter import VMwareProvider
from cfme.intelligence.reports.reports import CannedSavedReport
from utils import testgen
from utils.blockers import BZ
from utils.log import logger

pytestmark = [pytest.mark.tier(3),
              test_requirements.report,
              pytest.mark.usefixtures('setup_provider')]

pytest_generate_tests = testgen.generate(
    [OpenStackProvider, EC2Provider, RHEVMProvider, VMwareProvider],
    scope='module')


@pytest.yield_fixture(scope='module')
def create_report():
    # TODO parameterize on path, for now test infrastructure reports
    path = ["Configuration Management", "Hosts", "Virtual Infrastructure Platforms"]
    report = CannedSavedReport.new(path)
    report_time = report.datetime
    logger.debug('Created report for path {} and time {}'.format(path, report_time))
    yield report

    try:
        report.delete()
    except Exception:
开发者ID:rananda,项目名称:cfme_tests,代码行数:31,代码来源:test_views.py


示例13: testing_instance

from cfme.cloud.provider.ec2 import EC2Provider
from cfme.cloud.provider.openstack import OpenStackProvider
from cfme.services import requests
from utils import normalize_text, testgen
from utils.rest import assert_response
from utils.generators import random_vm_name
from utils.log import logger
from utils.update import update
from utils.version import current_version
from utils.wait import wait_for, RefreshTimer

pytestmark = [pytest.mark.meta(server_roles="+automate"),
              test_requirements.provision, pytest.mark.tier(2)]


pytest_generate_tests = testgen.generate(
    [CloudProvider], required_fields=[['provisioning', 'image']], scope="function")


@pytest.yield_fixture(scope="function")
def testing_instance(request, setup_provider, provider, provisioning, vm_name):
    """ Fixture to prepare instance parameters for provisioning
    """
    image = provisioning['image']['name']
    note = ('Testing provisioning from image {} to vm {} on provider {}'.format(
        image, vm_name, provider.key))

    instance = Instance.factory(vm_name, provider, image)

    inst_args = dict()

    # Base instance info
开发者ID:dajohnso,项目名称:cfme_tests,代码行数:32,代码来源:test_provisioning.py


示例14: pytest_generate_tests

from cfme.configure import configuration as conf
from selenium.common.exceptions import WebDriverException
from cfme.infrastructure.provider import wait_for_a_provider
import cfme.fixtures.pytest_selenium as sel
from time import sleep
from urlparse import urlparse
from utils import db, testgen, version
from utils.appliance import provision_appliance
from utils.conf import credentials
from utils.log import logger
from utils.ssh import SSHClient
from utils.wait import wait_for

pytestmark = [pytest.mark.long_running]

pytest_generate_tests = testgen.generate(testgen.infra_providers, scope="module")

random_vm_test = []


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:
开发者ID:pombredanne,项目名称:cfme_tests,代码行数:31,代码来源:test_appliance_replication.py


示例15: check_labels_in_ui

from cfme.containers.image import Image
from cfme.containers.project import Project
from cfme.containers.route import Route
from cfme.containers.template import Template
from cfme.exceptions import SetLabelException

from utils import testgen
from utils.wait import wait_for
from utils.log import logger
from utils.blockers import BZ


pytestmark = [
    pytest.mark.usefixtures('setup_provider_modscope'),
    pytest.mark.tier(1)]
pytest_generate_tests = testgen.generate([ContainersProvider], scope='module')


TEST_OBJECTS = (Pod, Service, Route, Template, Node, Replicator, Image, Project)


def check_labels_in_ui(instance, name, expected_value):
    if hasattr(instance.summary, 'labels') and \
            hasattr(instance.summary.labels, name.lower()):
        return getattr(instance.summary.labels, name.lower()).text_value == str(expected_value)
    return False


@pytest.fixture(scope='module')
def random_labels(provider, appliance):
    # Creating random instance for each object in TEST_OBJECTS and create a random label for it.
开发者ID:dajohnso,项目名称:cfme_tests,代码行数:31,代码来源:test_labels.py


示例16: copy_domain

from utils import testgen
from utils.log import logger
from utils.wait import wait_for

pytestmark = [
    test_requirements.service,
    pytest.mark.usefixtures("vm_name"),
    pytest.mark.usefixtures("catalog_item"),
    pytest.mark.usefixtures("uses_infra_providers"),
    pytest.mark.long_running,
    pytest.mark.meta(server_roles="+automate"),
    pytest.mark.tier(3),
]


pytest_generate_tests = testgen.generate(testgen.provider_by_type, ["virtualcenter"], scope="module")


@pytest.fixture(scope="function")
def copy_domain(request):
    domain = Domain(name=fauxfactory.gen_alphanumeric(), enabled=True)
    domain.create()
    request.addfinalizer(lambda: domain.delete() if domain.exists() else None)
    return domain


@pytest.yield_fixture(scope="function")
def myservice(setup_provider, provider, catalog_item, request):
    vm_name = catalog_item.provisioning_data["vm_name"]
    request.addfinalizer(lambda: cleanup_vm(vm_name + "_0001", provider))
    catalog_item.create()
开发者ID:ManageIQ,项目名称:integration_tests,代码行数:31,代码来源:test_add_remove_vm_to_service.py


示例17: test_reload_button_provider

import pytest

from cfme.containers.provider import ContainersProvider
from utils import testgen, version
from cfme.web_ui import toolbar as tb
from utils.appliance.implementations.ui import navigate_to


pytestmark = [
    pytest.mark.uncollectif(
        lambda: version.current_version() < "5.6"),
    pytest.mark.usefixtures('setup_provider'),
    pytest.mark.tier(2)]
pytest_generate_tests = testgen.generate([ContainersProvider], scope='function')


@pytest.mark.polarion('CMP-9878')
def test_reload_button_provider(provider):
    """ This test verifies the data integrity of the fields in
        the Relationships table after clicking the "reload"
        button. Fields that are being verified as part of provider.validate.stats():
        Projects, Routes, Container Services, Replicators, Pods, Containers, and Nodes.
        Images are being validated separately, since the total
        number of images in CFME 5.7 includes all images from the OSE registry as well
        as the images that are being created from the running pods. The images are searched
        according to the @sha. Image Registries are also validated separately.
    """

    navigate_to(provider, 'Details')
    tb.select('Reload Current Display')
    provider.validate_stats(ui=True)
开发者ID:rananda,项目名称:cfme_tests,代码行数:31,代码来源:test_reload_button_provider.py


示例18: tenant

import fauxfactory
import pytest
from cfme.cloud.provider.openstack import OpenStackProvider
from utils.update import update
from cfme.cloud.tenant import Tenant
from utils import testgen
from utils.log import logger
from utils.version import current_version


pytest_generate_tests = testgen.generate([OpenStackProvider], scope='module')


@pytest.yield_fixture(scope='function')
def tenant(provider, setup_provider):
    tenant = Tenant(name=fauxfactory.gen_alphanumeric(8), provider=provider)

    yield tenant

    try:
        if tenant.exists:
            tenant.delete()

    except Exception:
        logger.warning(
            'Exception while attempting to delete tenant fixture, continuing')
    finally:
        if tenant.name in provider.mgmt.list_tenant():
            provider.mgmt.remove_tenant(tenant.name)

开发者ID:dajohnso,项目名称:cfme_tests,代码行数:29,代码来源:test_tenant.py


示例19: vm_obj

from cfme.configure.configuration import VMwareConsoleSupport
from cfme.infrastructure.provider.virtualcenter import VMwareProvider
from cfme.configure import configuration
from cfme.common.vm import VM
from utils import testgen, version, ssh
from utils.appliance.implementations.ui import navigate_to
from utils.log import logger
from utils.conf import credentials
from utils.providers import ProviderFilter
from wait_for import wait_for

pytestmark = pytest.mark.usefixtures('setup_provider')

pytest_generate_tests = testgen.generate(
    gen_func=testgen.providers,
    filters=[ProviderFilter(classes=[CloudInfraProvider], required_flags=['html5_console'])],
    scope='module'
)


@pytest.fixture(scope="function")
def vm_obj(request, provider, setup_provider, console_template, vm_name):
    """
    Create a VM on the provider with the given template, and return the vm_obj.

    Also, it will remove VM from provider using nested function _delete_vm
    after the test is completed.

    """
    vm_obj = VM.factory(vm_name, provider, template_name=console_template)
开发者ID:dajohnso,项目名称:cfme_tests,代码行数:30,代码来源:test_html5_vm_console.py


示例20: enable_candu

from cfme.common.provider import BaseProvider
from cfme.exceptions import FlashMessageException
from utils import providers
from utils import testgen
from utils import conf
from utils.log import logger
from utils.version import current_version


# Tests for vmware,rhev, openstack, ec2, azure, gce providers have been moved to
# cfme/tests/test_utilization_metrics.py.
# Also, this test just verifies that C&U/perf data is being collected, whereas the tests in
# test_utilization_metrics.py go a step further and verify that specific performance metrics are
# being collected.Eventually, support should be added to verify that specific metrics are being
# collected for *all* providers.
pytest_generate_tests = testgen.generate(testgen.provider_by_type, [
    'container', 'middleware'], scope="module")


pytestmark = [
    pytest.mark.tier(1),
    test_requirements.c_and_u
]


@pytest.yield_fixture(scope="module")
def enable_candu():
    try:
        with server_roles_enabled(
                'ems_metrics_coordinator', 'ems_metrics_collector', 'ems_metrics_processor'):
            candu.enable_all()
            yield
开发者ID:jteehan,项目名称:cfme_tests,代码行数:32,代码来源:test_utilization.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python testgen.infra_providers函数代码示例发布时间:2022-05-26
下一篇:
Python testgen.all_providers函数代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap