mindsdb / mindsdb/mindsdb_python_sdk

test: limited test coverage for RestAPI error scenarios

Open
#210 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
44
Forks
16
Avg merge
6h 53m
Merged PRs (30d)
1

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Read tests/test_sdk.py and locate the mocked rest_api._raise_for_status assignment. Run the existing SDK tests first, then add coverage for 404 Not Found and 500 Internal Server Error responses without globally disabling error checking. Done means the failure scenarios are exercised and the test suite passes.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api, testing-qa
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.