Ignore c-extension-no-member pylint warnings in tests (#119378)

This commit is contained in:
epenet 2024-06-11 12:57:43 +02:00 committed by GitHub
parent 18f30d2ee9
commit 572700a326
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 6 additions and 2 deletions

View File

@ -129,7 +129,7 @@ async def test_setup_and_stop_passive(
assert init_kwargs == { assert init_kwargs == {
"adapter": "hci0", "adapter": "hci0",
"bluez": scanner.PASSIVE_SCANNER_ARGS, "bluez": scanner.PASSIVE_SCANNER_ARGS, # pylint: disable=c-extension-no-member
"scanning_mode": "passive", "scanning_mode": "passive",
"detection_callback": ANY, "detection_callback": ANY,
} }

View File

@ -309,6 +309,7 @@ async def test_stream_retries(
def av_open_side_effect(*args, **kwargs): def av_open_side_effect(*args, **kwargs):
hass.loop.call_soon_threadsafe(futures.pop().set_result, None) hass.loop.call_soon_threadsafe(futures.pop().set_result, None)
# pylint: disable-next=c-extension-no-member
raise av.error.InvalidDataError(-2, "error") raise av.error.InvalidDataError(-2, "error")
with ( with (

View File

@ -342,6 +342,7 @@ async def test_stream_open_fails(hass: HomeAssistant) -> None:
) )
stream.add_provider(HLS_PROVIDER) stream.add_provider(HLS_PROVIDER)
with patch("av.open") as av_open: with patch("av.open") as av_open:
# pylint: disable-next=c-extension-no-member
av_open.side_effect = av.error.InvalidDataError(-2, "error") av_open.side_effect = av.error.InvalidDataError(-2, "error")
with pytest.raises(StreamWorkerError): with pytest.raises(StreamWorkerError):
run_worker(hass, stream, STREAM_SOURCE) run_worker(hass, stream, STREAM_SOURCE)
@ -770,6 +771,7 @@ async def test_worker_log(
stream.add_provider(HLS_PROVIDER) stream.add_provider(HLS_PROVIDER)
with patch("av.open") as av_open: with patch("av.open") as av_open:
# pylint: disable-next=c-extension-no-member
av_open.side_effect = av.error.InvalidDataError(-2, "error") av_open.side_effect = av.error.InvalidDataError(-2, "error")
with pytest.raises(StreamWorkerError) as err: with pytest.raises(StreamWorkerError) as err:
run_worker(hass, stream, stream_url) run_worker(hass, stream, stream_url)

View File

@ -1686,10 +1686,11 @@ def mock_bleak_scanner_start() -> Generator[MagicMock]:
# We need to drop the stop method from the object since we patched # We need to drop the stop method from the object since we patched
# out start and this fixture will expire before the stop method is called # out start and this fixture will expire before the stop method is called
# when EVENT_HOMEASSISTANT_STOP is fired. # when EVENT_HOMEASSISTANT_STOP is fired.
# pylint: disable-next=c-extension-no-member
bluetooth_scanner.OriginalBleakScanner.stop = AsyncMock() # type: ignore[assignment] bluetooth_scanner.OriginalBleakScanner.stop = AsyncMock() # type: ignore[assignment]
with ( with (
patch.object( patch.object(
bluetooth_scanner.OriginalBleakScanner, bluetooth_scanner.OriginalBleakScanner, # pylint: disable=c-extension-no-member
"start", "start",
) as mock_bleak_scanner_start, ) as mock_bleak_scanner_start,
patch.object(bluetooth_scanner, "HaScanner"), patch.object(bluetooth_scanner, "HaScanner"),