Best Python code snippet using lisa_python
testsuite.py
Source:testsuite.py  
...200    environment: Optional[EnvironmentSpace] = None201    environment_status: EnvironmentStatus = EnvironmentStatus.Connected202    platform_type: Optional[search_space.SetSpace[str]] = None203    os_type: Optional[search_space.SetSpace[Type[OperatingSystem]]] = None204def _create_test_case_requirement(205    node: schema.NodeSpace,206    supported_platform_type: Optional[List[str]] = None,207    unsupported_platform_type: Optional[List[str]] = None,208    supported_os: Optional[List[Type[OperatingSystem]]] = None,209    unsupported_os: Optional[List[Type[OperatingSystem]]] = None,210    supported_features: Optional[211        List[Union[Type[Feature], schema.FeatureSettings, str]]212    ] = None,213    unsupported_features: Optional[214        List[Union[Type[Feature], schema.FeatureSettings, str]]215    ] = None,216    environment_status: EnvironmentStatus = EnvironmentStatus.Connected,217) -> TestCaseRequirement:218    if supported_features:219        node.features = search_space.SetSpace[schema.FeatureSettings](220            is_allow_set=True,221            items=[Feature.get_feature_settings(x) for x in supported_features],222        )223    if unsupported_features:224        node.excluded_features = search_space.SetSpace[schema.FeatureSettings](225            is_allow_set=False,226            items=[Feature.get_feature_settings(x) for x in unsupported_features],227        )228    nodes: List[schema.NodeSpace] = [node]229    platform_types = search_space.create_set_space(230        supported_platform_type, unsupported_platform_type, "platform type"231    )232    # Most test cases are applied to Linux, exclude Windows by default.233    if unsupported_os is None and supported_os is None:234        unsupported_os = [Windows]235    os = search_space.create_set_space(supported_os, unsupported_os, "operating system")236    return TestCaseRequirement(237        environment=EnvironmentSpace(nodes=nodes),238        platform_type=platform_types,239        os_type=os,240        environment_status=environment_status,241    )242def node_requirement(243    node: schema.NodeSpace,244    supported_platform_type: Optional[List[str]] = None,245    unsupported_platform_type: Optional[List[str]] = None,246    supported_os: Optional[List[Type[OperatingSystem]]] = None,247    unsupported_os: Optional[List[Type[OperatingSystem]]] = None,248    environment_status: EnvironmentStatus = EnvironmentStatus.Connected,249) -> TestCaseRequirement:250    return _create_test_case_requirement(251        node,252        supported_platform_type,253        unsupported_platform_type,254        supported_os,255        unsupported_os,256        None,257        None,258        environment_status,259    )260def simple_requirement(261    min_count: int = 1,262    min_core_count: int = 1,263    min_nic_count: Optional[int] = None,264    min_data_disk_count: Optional[int] = None,265    disk: Optional[schema.DiskOptionSettings] = None,266    network_interface: Optional[schema.NetworkInterfaceOptionSettings] = None,267    supported_platform_type: Optional[List[str]] = None,268    unsupported_platform_type: Optional[List[str]] = None,269    supported_os: Optional[List[Type[OperatingSystem]]] = None,270    unsupported_os: Optional[List[Type[OperatingSystem]]] = None,271    supported_features: Optional[272        List[Union[Type[Feature], schema.FeatureSettings, str]]273    ] = None,274    unsupported_features: Optional[275        List[Union[Type[Feature], schema.FeatureSettings, str]]276    ] = None,277    environment_status: EnvironmentStatus = EnvironmentStatus.Connected,278) -> TestCaseRequirement:279    """280    define a simple requirement to support most test cases.281    """282    node = schema.NodeSpace()283    node.node_count = search_space.IntRange(min=min_count)284    node.core_count = search_space.IntRange(min=min_core_count)285    if min_data_disk_count or disk:286        if not disk:287            disk = schema.DiskOptionSettings()288        if min_data_disk_count:289            disk.data_disk_count = search_space.IntRange(min=min_data_disk_count)290        node.disk = disk291    if min_nic_count or network_interface:292        if not network_interface:293            network_interface = schema.NetworkInterfaceOptionSettings()294        if min_nic_count:295            network_interface.nic_count = search_space.IntRange(min=min_nic_count)296        node.network_interface = network_interface297    return _create_test_case_requirement(298        node,299        supported_platform_type,300        unsupported_platform_type,301        supported_os,302        unsupported_os,303        supported_features,304        unsupported_features,305        environment_status,306    )307DEFAULT_REQUIREMENT = simple_requirement()308class TestSuiteMetadata:309    def __init__(310        self,311        area: str,...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.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!
