def setUp(self): self.mock_usb = _Mock690LcDevice(vendor_id=0xffff, product_id=0xb200, bus=1, port=(1, )) self.device = Legacy690Lc(self.mock_usb, 'Mock Legacy 690LC') self.device.connect()
def mockLegacy690LcDevice(): device = _Mock690LcDevice(vendor_id=0xffff, product_id=0xb200, bus=1, port=(1, )) dev = Legacy690Lc(device, 'Mock Legacy 690LC') dev.connect() return dev
def mockLegacy690LcDevice(): device = MockPyusbDevice(vendor_id=0xffff, product_id=0xb200, bus=1, port=(1, )) dev = Legacy690Lc(device, 'Mock Legacy 690LC') runtime_storage = MockRuntimeStorage(key_prefixes=['testing']) runtime_storage.store('leds_enabled', 0) dev.connect(runtime_storage=runtime_storage) return dev
def test_legacy_kraken_warning(self, repo_init: KrakenRepository, mocker: MockerFixture) -> None: # arrange mocker.patch.object(DeviceSettings, '__subclasses__', return_value=[SettingsKrakenLegacy]) mocker.patch.object(Legacy690Lc, 'find_supported_devices', return_value=[Legacy690Lc('012345', 'test device')]) mocker.patch.object(Legacy690Lc, 'connect') mocker.patch.object(Legacy690Lc, 'initialize') # act with pytest.raises(LegacyKrakenWarning) as warning: repo_init.has_supported_kraken() # assert assert 'driver conflict' in str(warning.value) # act 2 - after warning has been issued to the user is_supported = repo_init.has_supported_kraken() # assert 2 assert isinstance(repo_init._driver, Legacy690Lc) assert is_supported