mindsdb_python_sdk
mindsdb_python_sdk copied to clipboard
test: limited test coverage for RestAPI error scenarios
The test suite in tests/test_sdk.py has limited coverage for RestAPI error scenarios, such as handling 404 Not Found or 500 Internal Server Error responses.
This is because the function responsible for raising HTTP errors is globally mocked, preventing any tests for failure conditions. This can lead to unpredictable behavior in the SDK when it encounters real-world API errors, impacting its robustness and reliability.
The specific line in tests/test_sdk.py that disables error checking is:
# patch _raise_for_status
rest_api._raise_for_status = Mock()
I have developed a solution for this issue. If allowed, I would like to raise a pull request to add proper test coverage for these error cases.
Hi @ea-rus hope you’re doing well. When you have a moment, could you please review this issue? Your insights would be greatly appreciated. Thank you so much!
yes, i think this global mock of _raise_for_status can be removed and response_mock function should be used before every sdk call. at the moment it is skipped somewhere, for example for login and status
Exactly