Add autospec to modbus mock, in order to use getattr (#51813)

This commit is contained in:
jan iversen
2021-06-17 10:57:20 +02:00
committed by GitHub
parent ee6c77048c
commit 3ba90776c0

View File

@@ -97,12 +97,9 @@ async def base_test(
mock_sync = mock.MagicMock() mock_sync = mock.MagicMock()
with mock.patch( with mock.patch(
"homeassistant.components.modbus.modbus.ModbusTcpClient", return_value=mock_sync "homeassistant.components.modbus.modbus.ModbusTcpClient",
), mock.patch( autospec=True,
"homeassistant.components.modbus.modbus.ModbusSerialClient",
return_value=mock_sync, return_value=mock_sync,
), mock.patch(
"homeassistant.components.modbus.modbus.ModbusUdpClient", return_value=mock_sync
): ):
# Setup inputs for the sensor # Setup inputs for the sensor