def test(self): message = self.message colorprint(message[0], "YELLOW") flag = True # Switch OFF, res = CommandResult.parse( self.dut.execute_command("stack_nb_check", 5000)[1]) if res.rc == 0 and res.data["value"] == "1": self.logger.info("CSVFILE stack_check_next_bike ok ok pass") else: self.logger.info("CSVFILE stack_check_next_bike ok ng fail") flag = False op_messager(message[2]) # Switch ON, res = CommandResult.parse( self.dut.execute_command("stack_nb_check", 5000)[1]) if res.rc == 0 and res.data["value"] == "0": self.logger.info("CSVFILE stack_check_next_bike ok ok pass") else: self.logger.info("CSVFILE stack_check_next_bike ok ng fail") flag = False colorprint(message[3], "GREEN") return flag
def test(self): '''To run the motor calibration test''' message = self.message op_messager(message[0]) cmd_set = "motor_calibration" r, text_ = self.dut.execute_command(cmd_set, 70000) if r != 0: self.logger.info("CSVFILE Motor_Calibration ok ng fail") return False else: self.logger.info("CSVFILE Motor_Calibration ok ok pass") return True
def test(self): flag = False message = self.message colorprint(message[0], "YELLOW") op_messager(message[1]) rc, text = self.dut.execute_command("play_sound", 10000) if rc == 0: flag = question_box(message[2]) if flag: self.logger.info("CSVFILE play_sound ok ok pass") else: self.logger.info("CSVFILE play_sound ok fail fail") colorprint(message[3], "GREEN") return flag
def test(self): flag = False message = self.message op_messager(message[1]) # Turn on light res = CommandResult.parse( self.dut.execute_command("frontlight on", 4000)[1]) # op_messager(message[1]) if res.rc == 0: if question_box(message[2]): self.logger.info("CSVFILE check_light ok ok pass") flag = True self.dut.execute_command("frontlight off", 4000) if not flag: self.logger.info("CSVFILE check_light ok ng fail") colorprint(message[3], "GREEN") return flag
def test(self): flag = True message = self.message colorprint(message[0], "YELLOW") input() # No Brake OFF, res = CommandResult.parse( self.dut.execute_command("brake_check", 5000)[1]) if res.rc == 0 and res.data["left_brake"] == "0" and res.data[ "right_brake"] == "0": self.logger.info("CSVFILE left_brake_off ok ok pass") self.logger.info("CSVFILE right_brake_off ok ok pass") else: self.logger.info("CSVFILE left_brake_off ok ng fail") self.logger.info("CSVFILE right_brake_off ok ng fail") flag = False # Left Brake ON, op_messager(message[1]) res = CommandResult.parse( self.dut.execute_command("brake_check", 5000)[1]) if res.rc == 0 and res.data["left_brake"] == "1" and res.data[ "right_brake"] == "0": self.logger.info("CSVFILE left_brake_on ok ok pass") else: self.logger.info("CSVFILE left_brake_on ok ng fail") flag = False # Right Brake ON, op_messager(message[2]) res = CommandResult.parse( self.dut.execute_command("brake_check", 5000)[1]) if res.rc == 0 and res.data["left_brake"] == "0" and res.data[ "right_brake"] == "1": self.logger.info("CSVFILE right_brake_on ok ok pass") else: self.logger.info("CSVFILE right_brake_on ok ng fail") flag = False colorprint(message[3], "GREEN") return flag
def test(self): ENCODING = get_encoding() if ENCODING == 1 or ENCODING == 2: op_messager("動力電池檢測,按Enter鍵繼續 >>> ") else: op_messager( "Battery Detect, please put the personal battery on the holder, or Turn on 36V power supply, Then press ENTER..." ) flag = True res = CommandResult.parse( self.dut.execute_command("batt_detect", 5000)[1]) if res.rc == 0 and res.data["value"] == "0": self.logger.info("CSVFILE Battery_detect ok ok pass") else: self.logger.info("CSVFILE Battery_detect ok ng fail") flag = False colorprint("Test finished, Press ENTER...", "GREEN") return flag
def test(self): flag = False timeout = 60 message = self.message colorprint(message[0], "YELLOW") op_messager(message[1]) # Turn on electromagnet res = CommandResult.parse( self.dut.execute_command("electromagnet on", 4000)[1]) if res.rc == 0: # op_messager(message[2]) if question_box(message[3]): self.logger.info("CSVFILE check_electromagnet ok ok pass") flag = True self.dut.execute_command("electromagnet off", 4000) if not flag: self.logger.info("CSVFILE check_electromagnet ok ng fail") colorprint(message[4], "GREEN") return flag
def test(self): message = self.message flag = False colorprint(message[0], "YELLOW") # Turn on light res = CommandResult.parse( self.dut.execute_command("power_led on", 4000)[1]) if res.rc == 0: op_messager(message[1]) if question_box(message[2]): self.logger.info("CSVFILE check_power_led ok ok pass") flag = True self.dut.execute_command("power_led off", 4000) if not flag: self.logger.info("CSVFILE check_power_led ok ng fail") colorprint(message[3], "GREEN") return flag