Exemple #1
0
def test_serial_write(capsys):
    arduino = serial.Serial(port=c.ARDUINO_PORT,
                            baudrate=c.ARDUINO_BAUD,
                            timeout=c.ARDUINO_TIMEOUT)
    arduino.write("test string")

    captured = capsys.readouterr()
    assert captured.out == "test string\n"
Exemple #2
0
    def __init__(self):
        self.serial = serial_mock.Serial(
            port=constants.ARDUINO_PORT,
            baudrate=constants.ARDUINO_BAUD,
            timeout=constants.ARDUINO_TIMEOUT,
        )

        self.volume_in_pump = constants.volume_in_pump
        self.max_pump_capacity = constants.MAX_PUMP_CAPACITY
Exemple #3
0
def test_serial_readline():
    arduino = serial.Serial(port=c.ARDUINO_PORT,
                            baudrate=c.ARDUINO_BAUD,
                            timeout=c.ARDUINO_TIMEOUT)
    assert arduino.readline() == b"DONE\r\n"
Exemple #4
0
def test_serial_flush():
    arduino = serial.Serial(port=c.ARDUINO_PORT,
                            baudrate=c.ARDUINO_BAUD,
                            timeout=c.ARDUINO_TIMEOUT)
    arduino.flush()
Exemple #5
0
def test_serial_create():
    arduino = serial.Serial(port=c.ARDUINO_PORT,
                            baudrate=c.ARDUINO_BAUD,
                            timeout=c.ARDUINO_TIMEOUT)
    assert arduino is not None
Exemple #6
0
def test_serial_writable():
    arduino = serial.Serial(port=c.ARDUINO_PORT,
                            baudrate=c.ARDUINO_BAUD,
                            timeout=c.ARDUINO_TIMEOUT)
    assert arduino.writable()
Exemple #7
0
def test_serial_input_buffer():
    arduino = serial.Serial(port=c.ARDUINO_PORT,
                            baudrate=c.ARDUINO_BAUD,
                            timeout=c.ARDUINO_TIMEOUT)
    arduino.reset_input_buffer()
Exemple #8
0
def test_serial_write(capsys):
    arduino = serial.Serial(port=c.ARDUINO_PORT,
                            baudrate=c.ARDUINO_BAUD,
                            timeout=c.ARDUINO_TIMEOUT)
    arduino.write("test string")