added adaptive quickshell
This commit is contained in:
1 parent
6eb56d2065
commit
5b33a73fd8
189 files changed
+8678
-15
No files matched your search
@@ -0,0 +1,24 @@
|
||||
import importlib.util
|
||||
from pathlib import Path
|
||||
import tempfile
|
||||
import unittest
|
||||
|
||||
spec = importlib.util.spec_from_file_location('system_info', Path(__file__).resolve().parents[1] / 'backend/system_info.py')
|
||||
module = importlib.util.module_from_spec(spec)
|
||||
spec.loader.exec_module(module)
|
||||
|
||||
class SystemInfoTests(unittest.TestCase):
|
||||
def test_os_release(self):
|
||||
with tempfile.TemporaryDirectory() as folder:
|
||||
path = Path(folder) / 'os-release'
|
||||
path.write_text('PRETTY_NAME="Arch Linux ARM"\nIGNORED=secret\n')
|
||||
self.assertEqual(module.os_release(path), {'PRETTY_NAME': 'Arch Linux ARM'})
|
||||
def test_memory(self):
|
||||
with tempfile.TemporaryDirectory() as folder:
|
||||
path = Path(folder) / 'meminfo'
|
||||
path.write_text('MemTotal: 4096000 kB\nMemAvailable: 1024000 kB\n')
|
||||
self.assertEqual(module.memory_kib(path)['MemTotal'], 4096000)
|
||||
def test_uptime_invalid(self):
|
||||
self.assertEqual(module.uptime_seconds('/nonexistent/uptime'), 0)
|
||||
|
||||
if __name__ == '__main__': unittest.main()
|
||||
Reference in new issue
Block a user