[core] Re-enable preliminary module loading (stubbed)
Add logic for parsing commandline options, and a preliminary stub for loading modules. Note: The idea is that core.module.load() will return a valid, but empty, module that displays an error, if the module cannot be loaded
This commit is contained in:
parent
f234f81aa9
commit
8622673114
7 changed files with 68 additions and 6 deletions
21
tests/test_config.py
Normal file
21
tests/test_config.py
Normal file
|
@ -0,0 +1,21 @@
|
|||
import unittest
|
||||
|
||||
import core.config
|
||||
|
||||
class config(unittest.TestCase):
|
||||
def setUp(self):
|
||||
self._someModules = [ 'b', 'x', 'a' ]
|
||||
self._moreModules = [ 'this', 'module', 'here' ]
|
||||
|
||||
def tearDown(self):
|
||||
pass
|
||||
|
||||
def test_module_parameter(self):
|
||||
cfg = core.config.Config([ '-m' ] + self._someModules)
|
||||
self.assertEqual(self._someModules, cfg.modules())
|
||||
|
||||
def test_module_parameter_ordering_maintained(self):
|
||||
cfg = core.config.Config([ '-m' ] + self._someModules + [ '-m' ] + self._moreModules)
|
||||
self.assertEqual(self._someModules + self._moreModules, cfg.modules())
|
||||
|
||||
# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4
|
|
@ -12,16 +12,16 @@ class i3(unittest.TestCase):
|
|||
|
||||
def test_start(self):
|
||||
data = json.loads(self.i3.start())
|
||||
self.assertEquals(1, data['version'], 'i3bar protocol version 1 expected')
|
||||
self.assertEqual(1, data['version'], 'i3bar protocol version 1 expected')
|
||||
self.assertTrue(data['click_events'], 'click events should be enabled')
|
||||
|
||||
def test_begin_status_line(self):
|
||||
self.assertEquals('[', self.i3.begin_status_line(), 'each line must be a JSON array')
|
||||
self.assertEqual('[', self.i3.begin_status_line(), 'each line must be a JSON array')
|
||||
|
||||
def test_end_status_line(self):
|
||||
self.assertEquals('],\n', self.i3.end_status_line(), 'each line must terminate properly')
|
||||
self.assertEqual('],\n', self.i3.end_status_line(), 'each line must terminate properly')
|
||||
|
||||
def test_stop(self):
|
||||
self.assertEquals(']\n', self.i3.stop())
|
||||
self.assertEqual(']\n', self.i3.stop())
|
||||
|
||||
# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue