def test_get_total_memory_linux(self): """Test the function that gets the total memory.""" st.get_os_type = lambda: st.LINUX st.read_file = mocked_read_file st.os.path.exists = lambda fp: mocked_os_path_exists( PROC_MEMINFO_FP, fp) self.assertEqual(get_total_memory(), 64510)
def test_get_total_memory_native(self): """Test the function that gets the total memory.""" memtotal = get_total_memory() self.assertTrue(isinstance(memtotal, int))
def test_get_total_memory_darwin(self): """Test the function that gets the total memory.""" st.get_os_type = lambda: st.DARWIN st.run_cmd = mocked_run_cmd self.assertEqual(get_total_memory(), 8192)
def test_get_total_memory_linux(self): """Test the function that gets the total memory.""" st.get_os_type = lambda: st.LINUX st.read_file = mocked_read_file st.is_readable = lambda fp: mocked_is_readable(PROC_MEMINFO_FP, fp) self.assertEqual(get_total_memory(), 64510)