Best Python code snippet using lisa_python
tools.py
Source: tools.py
...71 return int(waagent_configuration["OS.RootDeviceScsiTimeout"])72 def get_resource_disk_mount_point(self) -> str:73 waagent_configuration = self.get_configuration()74 return waagent_configuration["ResourceDisk.MountPoint"]75 def is_swap_enabled(self) -> bool:76 waagent_configuration = self.get_configuration()77 is_swap_enabled = waagent_configuration["ResourceDisk.EnableSwap"]78 if is_swap_enabled == "y":79 return True80 elif is_swap_enabled == "n":81 return False82 else:83 raise LisaException(84 f"Unknown value for ResourceDisk.EnableSwap : {is_swap_enabled}"85 )86 def is_rdma_enabled(self) -> bool:87 waagent_configuration = self.get_configuration()88 is_rdma_enabled = waagent_configuration["OS.EnableRDMA"]89 if is_rdma_enabled == "y":...
test_cgroups_allocations.py
Source: test_cgroups_allocations.py
...76@pytest.mark.parametrize("raw_meminfo_output,expected", [77 ("SwapCached: 3000kB \nSwapTotal: 123000kB\nSwapFree: 20000kB", True),78 ("SwapCached: 0kB \nSwapTotal: 0kB\nSwapFree: 0 kB", False),79])80def test_is_swap_enabled(raw_meminfo_output, expected):81 with patch('wca.platforms.read_proc_meminfo',82 return_value=raw_meminfo_output):83 got = is_swap_enabled()84 assert got == expected85@patch('wca.platforms.read_proc_meminfo',86 return_value='SwapCached: 3000kB \nSwapTotal: 123000kB\nSwapFree: 20000kB')87@patch('wca.cgroups.Cgroup')88def test_migrate_pages_raise_exception_when_swap_is_enabled(*mocks):89 rdt_information = RDTInformation(True, True, True, True, '0', '0', 0, 0, 0)90 platform_mock = Mock(91 spec=Platform,92 cpus=10,93 sockets=1,94 rdt_information=rdt_information,95 node_cpus={0: [0, 1], 1: [2, 3]},96 numa_nodes=2,97 swap_enabled=is_swap_enabled(),98 )99 foo_container = Container(100 '/somepath', platform=platform_mock)101 foo_container._cgroup.platform = platform_mock102 migrate_pages = MigratePagesAllocationValue(0, foo_container, dict(foo='bar'))103 with pytest.raises(104 InvalidAllocations,105 match="Swap should be disabled due to possibility of OOM killer occurrence!"):106 migrate_pages.validate()107def test_cpuset_for_container_set():108 rdt_information = RDTInformation(True, True, True, True, '0', '0', 0, 0, 0)109 platform_mock = Mock(110 spec=Platform,111 cpus=10,...
memory.py
Source: memory.py
...8 self.setPropertyControlCallback(1212)9 self.setPropertyControlCallback(1213)10 def load(self):11 self.setPropertyControlValue(1211, self.sys.get_gpu_memorysplit())12 self.setPropertyControlValue(1212, self.sys.is_swap_enabled())13 self.setPropertyControlEnable(1213, self.sys.is_swap_enabled())14 self.setPropertyControlValue(1213, self.sys.get_swap_size())15 def onClick_1211(self):16 value = self.getPropertyControlValue(1211)17 if value is not None and value != '':18 self._lock()19 self.trace("Applying [%s] value for [%s] configuration property within %s file" % (str(value), self.sys.PROP_BOOT_GPU_MEM, self.sys.FILE_BOOT))20 self.sys.set_gpu_memorysplit(value)21 self.mark4reboot()22 self._unlock()23 def onClick_1212(self):24 value = self.any2bool(self.getPropertyControlValue(1212))25 if value is not None and value != '':26 self._lock()27 self.trace("Applying [%s] value for [%s] configuration property within %s file" %(str(value), self.sys.PROP_SWAP_ENABLED, self.sys.FILE_SWAP))28 self.sys.set_swap_enabled(value)29 self.setPropertyControlEnable(1213, self.sys.is_swap_enabled())30 self.mark4reboot()31 self._unlock()32 def onClick_1213(self):33 value = self.getPropertyControlValue(1213)34 if value is not None and value != '':35 self._lock()36 self.trace("Applying [%s] value for [%s] configuration property within %s file" %(str(value), self.sys.PROP_SWAP_SIZE, self.sys.FILE_SWAP))37 self.sys.set_swap_size(value)38 self.mark4reboot()...
Check out the latest blogs from LambdaTest on this topic:
Automating testing is a crucial step in the development pipeline of a software product. In an agile development environment, where there is continuous development, deployment, and maintenance of software products, automation testing ensures that the end software products delivered are error-free.
Before we discuss the Joomla testing, let us understand the fundamentals of Joomla and how this content management system allows you to create and maintain web-based applications or websites without having to write and implement complex coding requirements.
The QA testing career includes following an often long, winding road filled with fun, chaos, challenges, and complexity. Financially, the spectrum is broad and influenced by location, company type, company size, and the QA tester’s experience level. QA testing is a profitable, enjoyable, and thriving career choice.
It’s strange to hear someone declare, “This can’t be tested.” In reply, I contend that everything can be tested. However, one must be pleased with the outcome of testing, which might include failure, financial loss, or personal injury. Could anything be tested when a claim is made with this understanding?
When it comes to UI components, there are two versatile methods that we can use to build it for your website: either we can use prebuilt components from a well-known library or framework, or we can develop our UI components from scratch.
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!!