def dummy_attached_modules():
    temp_module = modules.TempDeck()
    temp_port = 'tty1_tempdeck'
    temp_serial = 'tdYYYYMMDD987'
    temp_module._device_info = {'serial': temp_serial}
    mag_module = modules.MagDeck()
    mag_port = 'tty1_magdeck'
    mag_serial = 'mdYYYYMMDD123'
    mag_module._device_info = {'serial': mag_serial}
    return {
        temp_port + 'tempdeck': temp_module,
        mag_port + 'magdeck': mag_module
    }
Пример #2
0
def test_run_tempdeck_connected(non_simulating, virtual_smoothie_env,
                                monkeypatch):
    connected = False

    def mock_connect(self, port):
        nonlocal connected
        connected = True

    def mock_write(command, ack, serial_connection):
        return 'ok\n\rok\n\r'

    def mock_get_info(self):
        return {'serial': 'abc123', 'model': '8675309', 'version': '9001'}

    monkeypatch.setattr(TempDeckDriver, 'connect', mock_connect)
    monkeypatch.setattr(TempDeckDriver, 'get_device_info', mock_get_info)
    monkeypatch.setattr(serial_communication, 'write_and_return', mock_write)
    tempdeck = modules.TempDeck(port='/dev/modules/tty1_tempdeck')
    tempdeck.connect()
    robot.modules = [tempdeck]
    modules.load('tempdeck', '5')
    assert connected
Пример #3
0
def new_bootloader_module():
    module = modules.TempDeck(port='/dev/modules/tty0_tempdeck')
    module._device_info = {'model': 'temp_deck_v1.1'}
    module._driver = TempDeckDriver()
    return module