[tests] Added first module tests (for CPU)
I finally *really* need to get started on testing. I've had too many releases in too short time intervals now, all because of small bugs/oversights.
This commit is contained in:
parent
af6055bd83
commit
9c95c0b319
4 changed files with 29 additions and 12 deletions
12
runtests.py
12
runtests.py
|
@ -1,12 +0,0 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import unittest
|
||||
|
||||
if __name__ == "__main__":
|
||||
suite = unittest.TestSuite()
|
||||
loader = unittest.TestLoader()
|
||||
suite.addTest(loader.discover("tests/"))
|
||||
|
||||
unittest.TextTestRunner(verbosity=2).run(suite)
|
||||
|
||||
# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4
|
3
runtests.sh
Executable file
3
runtests.sh
Executable file
|
@ -0,0 +1,3 @@
|
|||
#!/bin/sh
|
||||
|
||||
nosetests --rednose -v tests/
|
0
tests/modules/__init__.py
Normal file
0
tests/modules/__init__.py
Normal file
26
tests/modules/test_cpu.py
Normal file
26
tests/modules/test_cpu.py
Normal file
|
@ -0,0 +1,26 @@
|
|||
import unittest
|
||||
|
||||
import bumblebee.config
|
||||
import bumblebee.modules.cpu
|
||||
|
||||
class FakeOutput(object):
|
||||
def add_callback(self, cmd, button, module=None):
|
||||
pass
|
||||
|
||||
class TestCpuModule(unittest.TestCase):
|
||||
def setUp(self):
|
||||
output = FakeOutput()
|
||||
config = bumblebee.config.Config(["-m", "cpu"])
|
||||
self.cpu = bumblebee.modules.cpu.Module(output, config, None)
|
||||
|
||||
def test_documentation(self):
|
||||
self.assertTrue(hasattr(bumblebee.modules.cpu, "description"))
|
||||
self.assertTrue(hasattr(bumblebee.modules.cpu, "parameters"))
|
||||
|
||||
def test_warning(self):
|
||||
self.assertTrue(hasattr(self.cpu, "warning"))
|
||||
|
||||
def test_critical(self):
|
||||
self.assertTrue(hasattr(self.cpu, "critical"))
|
||||
|
||||
# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4
|
Loading…
Reference in a new issue