Ejemplo n.º 1
0
class TestModeHandler(unittest.TestCase):
    def setUp(self):
        self.handler = ModeHandler(TEST_MODES, MockController())

    def test_mode_handling(self):
        # init stopped
        self.assertFalse(self.handler.controller.started)

        # active modes
        for mode in TEST_MODES:
            msg = Mode(mode)
            self.handler._handle_mode_msg(msg)

            self.assertTrue(self.handler.controller.started)

        # inactive mode
        msg = Mode('_not_an_active_mode')
        self.handler._handle_mode_msg(msg)

        self.assertFalse(self.handler.controller.started)

    def test_shutdown(self):
        self.handler.controller.start()
        self.assertTrue(self.handler.controller.started)

        self.handler.shutdown()
        self.assertFalse(self.handler.controller.started)
Ejemplo n.º 2
0
 def setUp(self):
     self.handler = ModeHandler(TEST_MODES, MockController())
Ejemplo n.º 3
0
#!/usr/bin/env python

import rospy
from appctl_support import ProcController
from appctl_support import ModeHandler


if __name__ == '__main__':
    rospy.init_node('spin_test_node', anonymous=True)

    modes = ['test_appctl']
    cmd = ['/bin/sh', '-c', 'sleep 23023023']

    proc_controller = ProcController(cmd)
    mode_handler = ModeHandler(modes, proc_controller)
    mode_handler.begin_handling_modes()

    rospy.spin()

# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4
Ejemplo n.º 4
0
#!/usr/bin/env python

import rospy
from appctl_support import ProcController
from appctl_support import ModeHandler

if __name__ == '__main__':
    rospy.init_node('spin_test_node', anonymous=True)

    modes = ['test_appctl']
    cmd = ['/bin/sh', '-c', 'sleep 23023023']

    proc_controller = ProcController(cmd)
    mode_handler = ModeHandler(modes, proc_controller)
    mode_handler.begin_handling_modes()

    rospy.spin()

# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4