Esempio n. 1
0
def test1():
    """
    Roomba start, pause, and stop
    """
    gateway_logging.init_logger(".")

    print "Begin Roomba TEST 1"
    robot = gateway_roomba.GatewayRoomba()
    print "Roomba Start, status=", robot.get_status()
    time.sleep(2)
    robot.start()
    time.sleep(10)
    print "Roomba Pause, status=", robot.get_status()
    robot.motion_pause()
    time.sleep(3)
    print "Roomba Continue, status=", robot.get_status()
    robot.motion_continue()
    time.sleep(4)
    print "Roomba Stop, status=", robot.get_status()
    robot.stop()
    time.sleep(28)
    print "Roomba Close, status", robot.get_status()
    robot.close_roomba()
    print "End  Roomba TEST 1"

    return
    def test_multiple_calls(self):
        logger = logging.getLogger('gateway_code')

        gateway_logging.init_logger('.')
        handlers_one = logger.handlers
        gateway_logging.init_logger('.')
        handlers_two = logger.handlers

        self.assertEqual(handlers_one, handlers_two)
    def test_multiple_calls(self):
        logger = logging.getLogger('gateway_code')

        gateway_logging.init_logger('.')
        handlers_one = logger.handlers
        gateway_logging.init_logger('.')
        handlers_two = logger.handlers

        self.assertEquals(handlers_one, handlers_two)
    def test_stdout_logging(self, fake_stdout):
        logger = logging.getLogger('gateway_code')
        for handler in logger.handlers:
            logger.removeHandler(handler)

        gateway_logging.init_logger(tempfile.gettempdir(), log_stdout=True)

        test_log = 'Test log'
        logger.info(test_log)

        # sys.stdout received some data
        log_content = fake_stdout.getvalue()
        self.assertNotEqual(0, len(log_content))
        self.assertIn(test_log, log_content)
Esempio n. 5
0
    def __init__(self, log_folder='.', log_stdout=False):
        gateway_logging.init_logger(log_folder, log_stdout)

        self.board_cfg = board_config.BoardConfig()
        self.rlock = RLock()

        # Nodes instance
        self.open_node = self.board_cfg.board_class()
        self.control_node = self.board_cfg.cn_class(
            self.board_cfg.node_id, self.board_cfg.default_profile)
        self._nodes = {'control': self.control_node, 'open': self.open_node}

        # current experiment infos
        self.exp_id = None
        self.user = None
        self.exp_files = {}

        self.experiment_is_running = False
        self.user_log_handler = None
        self.timeout_timer = None