How to use _create_platform_requirement method in lisa

Best Python code snippet using lisa_python

lisa_runner.py

Source:lisa_runner.py Github

copy

Full Screen

...625 )626 # if platform defined requirement, replace the requirement from627 # test case.628 for test_result in test_results:629 platform_requirement = self._create_platform_requirement()630 test_req: TestCaseRequirement = test_result.runtime_data.requirement631 # check if there is platform requirement on test case632 if test_req.platform_type and len(test_req.platform_type) > 0:633 check_result = platform_type_set.check(test_req.platform_type)634 if not check_result.result:635 test_result.set_status(TestStatus.SKIPPED, check_result.reasons)636 continue637 if test_result.can_run:638 assert test_req.environment639 environment_requirement = copy.copy(test_req.environment)640 if platform_requirement:641 for index, node_requirement in enumerate(642 environment_requirement.nodes643 ):644 node_requirement_data: Dict[645 str, Any646 ] = node_requirement.to_dict() # type: ignore647 original_node_requirement = schema.load_by_type(648 schema.NodeSpace, node_requirement_data649 )650 # Manage the union of the platform requirements and the node651 # requirements before taking the intersection of652 # the rest of the requirements.653 platform_requirement.features = search_space.SetSpace(654 True,655 (656 platform_requirement.features.items657 if platform_requirement.features658 else []659 )660 + (661 original_node_requirement.features.items662 if original_node_requirement.features663 else []664 ),665 )666 platform_requirement.excluded_features = search_space.SetSpace(667 False,668 (669 platform_requirement.excluded_features.items670 if platform_requirement.excluded_features671 else []672 )673 + (674 original_node_requirement.excluded_features.items675 if original_node_requirement.excluded_features676 else []677 ),678 )679 try:680 node_requirement = original_node_requirement.intersect(681 platform_requirement682 )683 except NotMeetRequirementException as identifier:684 test_result.set_status(TestStatus.SKIPPED, str(identifier))685 break686 assert isinstance(platform_requirement.extended_schemas, dict)687 assert isinstance(node_requirement.extended_schemas, dict)688 node_requirement.extended_schemas = deep_update_dict(689 platform_requirement.extended_schemas,690 node_requirement.extended_schemas,691 )692 environment_requirement.nodes[index] = node_requirement693 if test_result.can_run:694 # the requirement may be skipped by high platform requirement.695 env = existing_environments.from_requirement(environment_requirement)696 if env:697 # if env prepare or deploy failed and the test result is not698 # run, the failure will attach to this test result.699 env.source_test_result = test_result700 def _create_platform_requirement(self) -> Optional[schema.NodeSpace]:701 if not hasattr(self, "platform"):702 return None703 platform_requirement_data = cast(704 schema.Platform, self.platform.runbook705 ).requirement706 if platform_requirement_data is None:707 return None708 platform_requirement: schema.NodeSpace = schema.load_by_type(709 schema.Capability, platform_requirement_data710 )711 # fill in required fields as max capability. So it can be712 # used as a capability in next steps to merge with test requirement.713 if not platform_requirement.disk:714 platform_requirement.disk = schema.DiskOptionSettings()...

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