From 11ebcee29a34d8a5b3ab9957bef9d94be06867e2 Mon Sep 17 00:00:00 2001 From: tobi-wan-kenobi Date: Sun, 29 Mar 2020 14:35:20 +0200 Subject: [PATCH] [tests] Fix kernel module test --- modules/contrib/dunst.py | 2 +- modules/core/battery.py | 2 +- modules/core/brightness.py | 2 +- modules/core/cpu.py | 2 +- modules/core/disk.py | 2 +- modules/core/kernel.py | 2 +- modules/core/memory.py | 2 +- modules/core/redshift.py | 2 +- modules/core/sensors2.py | 2 +- modules/core/test.py | 2 +- modules/core/xrandr.py | 2 +- tests/modules/test_kernel.py | 3 ++- 12 files changed, 13 insertions(+), 12 deletions(-) diff --git a/modules/contrib/dunst.py b/modules/contrib/dunst.py index 97209cb..10cd362 100644 --- a/modules/contrib/dunst.py +++ b/modules/contrib/dunst.py @@ -9,7 +9,7 @@ import core.input import util.cli class Module(core.module.Module): - def __init__(self, config=None): + def __init__(self, config): super().__init__(config, core.widget.Widget('')) self._paused = False # Make sure that dunst is currently not paused diff --git a/modules/core/battery.py b/modules/core/battery.py index 92c2cea..f5ecbdc 100644 --- a/modules/core/battery.py +++ b/modules/core/battery.py @@ -29,7 +29,7 @@ import util.format class Module(core.module.Module): - def __init__(self, config=None): + def __init__(self, config): widgets = [] super().__init__(config, widgets) diff --git a/modules/core/brightness.py b/modules/core/brightness.py index 41f3fd2..78f65d3 100644 --- a/modules/core/brightness.py +++ b/modules/core/brightness.py @@ -16,7 +16,7 @@ import core.widget import core.input class Module(core.module.Module): - def __init__(self, config=None): + def __init__(self, config): super().__init__(config, core.widget.Widget(self.brightness)) self._brightness = 0 diff --git a/modules/core/cpu.py b/modules/core/cpu.py index 250f177..c25ab5b 100644 --- a/modules/core/cpu.py +++ b/modules/core/cpu.py @@ -15,7 +15,7 @@ import core.widget import core.input class Module(core.module.Module): - def __init__(self, config=None): + def __init__(self, config): super().__init__(config, core.widget.Widget(self.utilization)) self.widget().set('theme.minwidth', self._format.format(100.0-10e-20)) self._utilization = psutil.cpu_percent(percpu=False) diff --git a/modules/core/disk.py b/modules/core/disk.py index b98d5ca..a4dfebb 100644 --- a/modules/core/disk.py +++ b/modules/core/disk.py @@ -19,7 +19,7 @@ import core.input import util.format class Module(core.module.Module): - def __init__(self, config=None): + def __init__(self, config): super().__init__(config, core.widget.Widget(self.diskspace)) self._path = self.parameter('path', '/') diff --git a/modules/core/kernel.py b/modules/core/kernel.py index c70c7f6..2ce05f1 100644 --- a/modules/core/kernel.py +++ b/modules/core/kernel.py @@ -9,7 +9,7 @@ import core.widget class Module(core.module.Module): @core.module.every(minutes=60) - def __init__(self, config=None): + def __init__(self, config): super().__init__(config, core.widget.Widget(self.full_text)) def full_text(self, widgets): diff --git a/modules/core/memory.py b/modules/core/memory.py index 7fe4e84..2a6b090 100644 --- a/modules/core/memory.py +++ b/modules/core/memory.py @@ -18,7 +18,7 @@ import core.input import util.format class Module(core.module.Module): - def __init__(self, config=None): + def __init__(self, config): super().__init__(config, core.widget.Widget(self.memory_usage)) core.input.register(self, button=core.input.LEFT_MOUSE, cmd='gnome-system-monitor') diff --git a/modules/core/redshift.py b/modules/core/redshift.py index cb43b90..24cc6f1 100644 --- a/modules/core/redshift.py +++ b/modules/core/redshift.py @@ -75,7 +75,7 @@ def get_redshift_value(widget, location, lat, lon): widget.set('transition', ' '.join(line.split(' ')[2:])) class Module(core.module.Module): - def __init__(self, config=None): + def __init__(self, config): widget = core.widget.Widget(self.text) super().__init__(config, widget) diff --git a/modules/core/sensors2.py b/modules/core/sensors2.py index 1726dae..120800a 100644 --- a/modules/core/sensors2.py +++ b/modules/core/sensors2.py @@ -22,7 +22,7 @@ import util.cli import util.format class Module(core.module.Module): - def __init__(self, config=None): + def __init__(self, config): super().__init__(config, []) self.__chip = self.parameter('chip', '') diff --git a/modules/core/test.py b/modules/core/test.py index ef0dde6..c88ccf4 100644 --- a/modules/core/test.py +++ b/modules/core/test.py @@ -7,7 +7,7 @@ import core.widget import core.module class Module(core.module.Module): - def __init__(self, config=None): + def __init__(self, config): super().__init__(config, core.widget.Widget('test')) # vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4 diff --git a/modules/core/xrandr.py b/modules/core/xrandr.py index 2145bea..a62e0f5 100644 --- a/modules/core/xrandr.py +++ b/modules/core/xrandr.py @@ -33,7 +33,7 @@ except: pass class Module(core.module.Module): - def __init__(self, config=None): + def __init__(self, config): widgets = [] super().__init__(config, widgets) diff --git a/tests/modules/test_kernel.py b/tests/modules/test_kernel.py index eeeb73d..bef3472 100644 --- a/tests/modules/test_kernel.py +++ b/tests/modules/test_kernel.py @@ -1,11 +1,12 @@ import unittest +import core.config import modules.core.kernel class kernel(unittest.TestCase): def setUp(self): self.someKernel = 'this-is-my-kernel' - self.module = modules.core.kernel.Module() + self.module = modules.core.kernel.Module(config=core.config.Config([])) def test_full_text(self): with unittest.mock.patch('modules.core.kernel.platform') as platform: