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
 def test_has_supported_kraken_no_device_found(self, repo_init: KrakenRepository, mocker: MockerFixture) -> None:
     # arrange
     mocker.patch.object(DeviceSettings, '__subclasses__', return_value=[])
     # act
     is_supported = repo_init.has_supported_kraken()
     # assert
     assert repo_init._driver is None
     assert not is_supported
 def test_has_supported_kraken_yes(self, repo_init: KrakenRepository, mocker: MockerFixture) -> None:
     # arrange
     mocker.patch.object(DeviceSettings, '__subclasses__', return_value=[SettingsKraken2])
     mocker.patch.object(Kraken2, 'find_supported_devices', return_value=[Kraken2('012345', 'test device')])
     mocker.patch.object(Kraken2, 'connect')
     mocker.patch.object(Kraken2, 'initialize')
     # act
     is_supported = repo_init.has_supported_kraken()
     # assert
     assert isinstance(repo_init._driver, Kraken2)
     assert is_supported
 def test_has_supported_kraken_connection_error(self, repo_init: KrakenRepository, mocker: MockerFixture) -> None:
     # arrange
     mocker.patch.object(DeviceSettings, '__subclasses__', return_value=[SettingsKraken2])
     mocker.patch.object(Kraken2, 'find_supported_devices', return_value=[Kraken2('012345', 'test device')])
     mocker.patch.object(Kraken2, 'connect', side_effect=OSError("open failed"))
     mocker.patch.object(Kraken2, 'disconnect')
     # act
     is_supported = repo_init.has_supported_kraken()
     # assert
     assert repo_init._driver is None  # should be reset after has_supported_kraken call
     assert is_supported