Let caller handle SMART errors on multi-requests (#754)

* Fix for missing get_device_usage

* Fix coverage and add methods to exceptions

* Remove unused caplog fixture
This commit is contained in:
Steven B
2024-02-15 18:10:34 +00:00
committed by GitHub
parent 64da736717
commit 9ab9420ad6
5 changed files with 84 additions and 26 deletions

View File

@@ -60,13 +60,10 @@ async def test_smart_device_errors_in_multiple_request(
send_mock = mocker.patch.object(
dummy_protocol._transport, "send", return_value=mock_response
)
with pytest.raises(SmartDeviceException):
await dummy_protocol.query(DUMMY_MULTIPLE_QUERY, retry_count=2)
if error_code in chain(SMART_TIMEOUT_ERRORS, SMART_RETRYABLE_ERRORS):
expected_calls = 3
else:
expected_calls = 1
assert send_mock.call_count == expected_calls
resp_dict = await dummy_protocol.query(DUMMY_MULTIPLE_QUERY, retry_count=2)
assert resp_dict["foobar2"] == error_code
assert send_mock.call_count == 1
@pytest.mark.parametrize("request_size", [1, 3, 5, 10])