Another iteration based on feedback from hardware synth testing.
This commit is contained in:
@@ -146,6 +146,28 @@ def test_auto_device_detection_fails_when_no_serial_device(monkeypatch):
|
||||
)
|
||||
|
||||
|
||||
def test_hardware_driver_retries_partial_serial_writes(monkeypatch):
|
||||
speech_driver = litetalkDriver.driver()
|
||||
speech_driver.env = build_environment("/dev/ttyUSB0")
|
||||
speech_driver.serial_port = 12
|
||||
written_chunks = []
|
||||
|
||||
def fake_write(port, data):
|
||||
assert port == 12
|
||||
chunk = data[:2]
|
||||
written_chunks.append(chunk)
|
||||
return len(chunk)
|
||||
|
||||
monkeypatch.setattr(
|
||||
"fenrirscreenreader.speechDriver.hardwareSerialDriver.os.write",
|
||||
fake_write,
|
||||
)
|
||||
|
||||
speech_driver._write_bytes(b"abcdef", "speech")
|
||||
|
||||
assert written_chunks == [b"ab", b"cd", b"ef"]
|
||||
|
||||
|
||||
@pytest.mark.parametrize("driver_class", [doubletalkDriver, tripletalkDriver])
|
||||
def test_litetalk_compatible_alias_drivers(driver_class, serial_pair):
|
||||
speech_driver, master_fd = initialized_driver(driver_class, serial_pair)
|
||||
|
||||
Reference in New Issue
Block a user