[tests] Fix kernel module test

This commit is contained in:
tobi-wan-kenobi 2020-03-29 14:35:20 +02:00
parent bd7ff3c8f1
commit 11ebcee29a
12 changed files with 13 additions and 12 deletions

View file

@ -9,7 +9,7 @@ import core.input
import util.cli import util.cli
class Module(core.module.Module): class Module(core.module.Module):
def __init__(self, config=None): def __init__(self, config):
super().__init__(config, core.widget.Widget('')) super().__init__(config, core.widget.Widget(''))
self._paused = False self._paused = False
# Make sure that dunst is currently not paused # Make sure that dunst is currently not paused

View file

@ -29,7 +29,7 @@ import util.format
class Module(core.module.Module): class Module(core.module.Module):
def __init__(self, config=None): def __init__(self, config):
widgets = [] widgets = []
super().__init__(config, widgets) super().__init__(config, widgets)

View file

@ -16,7 +16,7 @@ import core.widget
import core.input import core.input
class Module(core.module.Module): class Module(core.module.Module):
def __init__(self, config=None): def __init__(self, config):
super().__init__(config, core.widget.Widget(self.brightness)) super().__init__(config, core.widget.Widget(self.brightness))
self._brightness = 0 self._brightness = 0

View file

@ -15,7 +15,7 @@ import core.widget
import core.input import core.input
class Module(core.module.Module): class Module(core.module.Module):
def __init__(self, config=None): def __init__(self, config):
super().__init__(config, core.widget.Widget(self.utilization)) super().__init__(config, core.widget.Widget(self.utilization))
self.widget().set('theme.minwidth', self._format.format(100.0-10e-20)) self.widget().set('theme.minwidth', self._format.format(100.0-10e-20))
self._utilization = psutil.cpu_percent(percpu=False) self._utilization = psutil.cpu_percent(percpu=False)

View file

@ -19,7 +19,7 @@ import core.input
import util.format import util.format
class Module(core.module.Module): class Module(core.module.Module):
def __init__(self, config=None): def __init__(self, config):
super().__init__(config, core.widget.Widget(self.diskspace)) super().__init__(config, core.widget.Widget(self.diskspace))
self._path = self.parameter('path', '/') self._path = self.parameter('path', '/')

View file

@ -9,7 +9,7 @@ import core.widget
class Module(core.module.Module): class Module(core.module.Module):
@core.module.every(minutes=60) @core.module.every(minutes=60)
def __init__(self, config=None): def __init__(self, config):
super().__init__(config, core.widget.Widget(self.full_text)) super().__init__(config, core.widget.Widget(self.full_text))
def full_text(self, widgets): def full_text(self, widgets):

View file

@ -18,7 +18,7 @@ import core.input
import util.format import util.format
class Module(core.module.Module): class Module(core.module.Module):
def __init__(self, config=None): def __init__(self, config):
super().__init__(config, core.widget.Widget(self.memory_usage)) super().__init__(config, core.widget.Widget(self.memory_usage))
core.input.register(self, button=core.input.LEFT_MOUSE, core.input.register(self, button=core.input.LEFT_MOUSE,
cmd='gnome-system-monitor') cmd='gnome-system-monitor')

View file

@ -75,7 +75,7 @@ def get_redshift_value(widget, location, lat, lon):
widget.set('transition', ' '.join(line.split(' ')[2:])) widget.set('transition', ' '.join(line.split(' ')[2:]))
class Module(core.module.Module): class Module(core.module.Module):
def __init__(self, config=None): def __init__(self, config):
widget = core.widget.Widget(self.text) widget = core.widget.Widget(self.text)
super().__init__(config, widget) super().__init__(config, widget)

View file

@ -22,7 +22,7 @@ import util.cli
import util.format import util.format
class Module(core.module.Module): class Module(core.module.Module):
def __init__(self, config=None): def __init__(self, config):
super().__init__(config, []) super().__init__(config, [])
self.__chip = self.parameter('chip', '') self.__chip = self.parameter('chip', '')

View file

@ -7,7 +7,7 @@ import core.widget
import core.module import core.module
class Module(core.module.Module): class Module(core.module.Module):
def __init__(self, config=None): def __init__(self, config):
super().__init__(config, core.widget.Widget('test')) super().__init__(config, core.widget.Widget('test'))
# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4 # vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4

View file

@ -33,7 +33,7 @@ except:
pass pass
class Module(core.module.Module): class Module(core.module.Module):
def __init__(self, config=None): def __init__(self, config):
widgets = [] widgets = []
super().__init__(config, widgets) super().__init__(config, widgets)

View file

@ -1,11 +1,12 @@
import unittest import unittest
import core.config
import modules.core.kernel import modules.core.kernel
class kernel(unittest.TestCase): class kernel(unittest.TestCase):
def setUp(self): def setUp(self):
self.someKernel = 'this-is-my-kernel' 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): def test_full_text(self):
with unittest.mock.patch('modules.core.kernel.platform') as platform: with unittest.mock.patch('modules.core.kernel.platform') as platform: