Best Python code snippet using lisa_python
transformers.py
Source:transformers.py
...219 environment = envs.from_requirement(environment_requirement)220 assert environment221 platform.prepare_environment(environment=environment)222 platform.deploy_environment(environment)223 resource_group_name = get_environment_context(environment).resource_group_name224 # generate return results225 results = {226 self.__resource_group_name: resource_group_name,227 }228 node: RemoteNode = cast(RemoteNode, environment.default_node)229 connection_info = node.connection_info230 assert connection_info231 results.update(connection_info)232 return results233class DeleteTransformer(Transformer):234 """235 delete an environment236 """237 @classmethod238 def type_name(cls) -> str:239 return "azure_delete"240 @classmethod241 def type_schema(cls) -> Type[schema.TypedSchema]:242 return DeleteTransformerSchema243 @property244 def _output_names(self) -> List[str]:245 return []246 def _internal_run(self) -> Dict[str, Any]:247 platform = _load_platform(self._runbook_builder, self.type_name())248 runbook: DeleteTransformerSchema = self.runbook249 # mock up environment for deletion250 envs = Environments()251 environment_requirement = EnvironmentSpace()252 environment_requirement.nodes.append(schema.NodeSpace())253 environment = envs.from_requirement(environment_requirement)254 assert environment255 environment_context = get_environment_context(environment)256 environment_context.resource_group_name = runbook.resource_group_name257 environment_context.resource_group_is_specified = True258 platform.delete_environment(environment)259 return {}260def _load_platform(261 runbook_builder: RunbookBuilder, transformer_name: str262) -> AzurePlatform:263 platform = load_platform_from_builder(runbook_builder)264 assert isinstance(265 platform, AzurePlatform266 ), f"'{transformer_name}' support only Azure platform"267 platform.initialize()...
config.py
Source:config.py
...46 return instance.to_json()47 return self._json_context.get(key)48 def set_context_entry(self, entry):49 self._object_context[entry.CONFIG_CONTEXT_KEY] = entry50 def get_environment_context(self):51 context = dict(self._json_context)52 for key, value in self._object_context.items():53 context[key] = value.to_json()54 return {self.CONTEXT_ENVIRONMENT_KEY: base64.b64encode(json.dumps(context).encode())}55 @property56 def api_token(self):57 return self._configuration.get(self.API_TOKEN_KEY)58 @property59 def cell_tracking_enabled(self):60 return self._configuration.get(self.CELL_TRACKING_ENABLED_KEY, False)61 @property62 def log_collection_enabled(self):63 return self._configuration.get(self.LOG_COLLECTION_ENABLED_KEY, False)64 def _ensure_config_json_path(self):...
context.py
Source:context.py
...34 machine_type: Optional[str] = None35 enable_secure_boot: bool = False36 console_logger: Optional[QemuConsoleLogger] = None37 domain: Optional[libvirt.virDomain] = None38def get_environment_context(environment: Environment) -> EnvironmentContext:39 return environment.get_context(EnvironmentContext)40def get_node_context(node: Node) -> NodeContext:...
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!!