How to use ut_simple_requirement method in lisa

Best Python code snippet using lisa_python

test_env_requirement.py

Source:test_env_requirement.py Github

copy

Full Screen

...50 result = TestCaseSchema(51 environment=environment, platform_type=platform_type, operating_system=os52 )53 return result54def ut_simple_requirement(55 min_count: int = 1,56 supported_platform_type: Optional[List[str]] = None,57 unsupported_platform_type: Optional[List[str]] = None,58 supported_os: Optional[List[Type[OperatingSystem]]] = None,59 unsupported_os: Optional[List[Type[OperatingSystem]]] = None,60) -> UtTestCaseRequirement:61 simple = simple_requirement(62 min_count=min_count,63 supported_platform_type=supported_platform_type,64 unsupported_platform_type=unsupported_platform_type,65 supported_os=supported_os,66 unsupported_os=unsupported_os,67 )68 return UtTestCaseRequirement(69 environment=simple.environment,70 platform_type=simple.platform_type,71 os_type=simple.os_type,72 )73def ut_node_requirement(74 node: schema.NodeSpace,75 supported_platform_type: Optional[List[str]] = None,76 unsupported_platform_type: Optional[List[str]] = None,77 supported_os: Optional[List[Type[OperatingSystem]]] = None,78 unsupported_os: Optional[List[Type[OperatingSystem]]] = None,79) -> UtTestCaseRequirement:80 node_require = node_requirement(81 node,82 supported_platform_type,83 unsupported_platform_type,84 supported_os,85 unsupported_os,86 )87 return UtTestCaseRequirement(88 environment=node_require.environment,89 platform_type=node_require.platform_type,90 os_type=node_require.os_type,91 )92UT_DEFAULT_REQUIREMENT = UtTestCaseRequirement(93 environment=DEFAULT_REQUIREMENT.environment,94 platform_type=DEFAULT_REQUIREMENT.platform_type,95 os_type=SetSpace(is_allow_set=True, items=[Linux]),96)97class RequirementTestCase(SearchSpaceTestCase):98 def test_supported_simple_requirement(self) -> None:99 n1 = schema.NodeSpace()100 n1 = n1.generate_min_capability(n1)101 n4 = schema.load_by_type(102 schema.NodeSpace,103 {"type": constants.ENVIRONMENTS_NODES_REQUIREMENT, "core_count": 4},104 )105 n4 = n4.generate_min_capability(n4)106 n4g1 = schema.load_by_type(107 schema.NodeSpace,108 {109 "type": constants.ENVIRONMENTS_NODES_REQUIREMENT,110 "core_count": 4,111 "gpu_count": 1,112 },113 )114 n4g1 = n4g1.generate_min_capability(n4g1)115 n6 = schema.load_by_type(116 schema.NodeSpace,117 {"type": constants.ENVIRONMENTS_NODES_REQUIREMENT, "core_count": 6},118 )119 n6 = n6.generate_min_capability(n6)120 n6g2 = schema.load_by_type(121 schema.NodeSpace,122 {123 "type": constants.ENVIRONMENTS_NODES_REQUIREMENT,124 "core_count": 6,125 "gpu_count": 2,126 },127 )128 n6g2 = n6g2.generate_min_capability(n6g2)129 n6g1 = schema.load_by_type(130 schema.NodeSpace,131 {132 "type": constants.ENVIRONMENTS_NODES_REQUIREMENT,133 "core_count": 6,134 "gpu_count": 1,135 },136 )137 n6g1 = n6g1.generate_min_capability(n6g1)138 n10 = schema.load_by_type(139 schema.NodeSpace,140 {"type": constants.ENVIRONMENTS_NODES_REQUIREMENT, "core_count": 10},141 )142 n10 = n10.generate_min_capability(n10)143 partial_testcase_schema = partial(144 TestCaseSchema,145 platform_type=None,146 operating_system=SetSpace(is_allow_set=True, items=[Linux]),147 )148 s11 = partial_testcase_schema(environment=EnvironmentSpace())149 s11.environment.nodes = [n1]150 s14 = partial_testcase_schema(environment=EnvironmentSpace())151 s14.environment.nodes = [n4]152 s14g1 = partial_testcase_schema(environment=EnvironmentSpace())153 s14g1.environment.nodes = [n4g1]154 s24 = partial_testcase_schema(environment=EnvironmentSpace())155 s24.environment.nodes = [n4, n4]156 s16 = partial_testcase_schema(environment=EnvironmentSpace())157 s16.environment.nodes = [n6]158 s16g2 = partial_testcase_schema(environment=EnvironmentSpace())159 s16g2.environment.nodes = [n6g2]160 s16g1 = partial_testcase_schema(environment=EnvironmentSpace())161 s16g1.environment.nodes = [n6g1]162 s110 = partial_testcase_schema(environment=EnvironmentSpace())163 s110.environment.nodes = [n10]164 s2i6 = partial_testcase_schema(environment=EnvironmentSpace())165 s2i6.environment.nodes = [n6, n6]166 s266 = partial_testcase_schema(environment=EnvironmentSpace())167 s266.environment.nodes = [n6, n6]168 s2610 = partial_testcase_schema(environment=EnvironmentSpace())169 s2610.environment.nodes = [n6, n10]170 s2106 = partial_testcase_schema(environment=EnvironmentSpace())171 s2106.environment.nodes = [n10, n6]172 self._verify_matrix(173 expected_meet=[174 [True, True, True, True, True, True, True, True, True],175 [True, True, True, True, True, True, True, True, True],176 [True, True, True, True, False, True, True, True, False],177 [False, False, False, False, False, True, True, False, False],178 [True, True, True, True, False, True, True, True, False],179 [True, False, True, False, False, False, False, False, False],180 ],181 expected_min=[182 [s11, s16, s16, s16g2, s110, s16, s16, s16, s110],183 [s11, s16, s16, s16g2, s110, s16, s16, s16, s110],184 [s14, s16, s16, s16g2, False, s16, s16, s16, False],185 [False, False, False, False, False, s2i6, s2i6, False, False],186 [s16, s16, s16, s16g2, False, s16, s16, s16, False],187 [s14g1, False, s16g1, False, False, False, False, False, False],188 ],189 requirements=[190 UT_DEFAULT_REQUIREMENT,191 ut_simple_requirement(supported_os=[Linux]),192 ut_node_requirement(193 node=schema.NodeSpace(core_count=IntRange(4, 8)),194 supported_os=[Linux],195 ),196 ut_node_requirement(197 node=schema.NodeSpace(node_count=2, core_count=IntRange(4, 8)),198 supported_os=[Linux],199 ),200 UtTestCaseRequirement(201 environment=EnvironmentSpace(202 nodes=[schema.NodeSpace(core_count=6, node_count=1)]203 ),204 os_type=SetSpace(is_allow_set=True, items=[Linux]),205 ),206 ut_node_requirement(207 node=schema.NodeSpace(208 node_count=1, core_count=IntRange(4, 8), gpu_count=1209 ),210 supported_os=[Linux],211 ),212 ],213 capabilities=[214 ut_simple_requirement(supported_os=[Linux]),215 UtTestCaseRequirement(216 environment=EnvironmentSpace(217 nodes=[218 schema.NodeSpace(core_count=6, node_count=1, gpu_count=0)219 ]220 ),221 os_type=SetSpace(is_allow_set=True, items=[Linux]),222 ),223 UtTestCaseRequirement(224 environment=EnvironmentSpace(225 nodes=[226 schema.NodeSpace(227 node_count=1, core_count=6, gpu_count=IntRange(max=2)228 )...

Full Screen

Full Screen

Automation Testing Tutorials

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.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run lisa automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful