openml-python
openml-python copied to clipboard
[MNT] Replace live server calls with mocks in test_task_methods.py
Metadata
- Reference Issue: Fixes #1649 (
tests/test_tasks/test_task_methods.py) - New Tests Added: No
- Documentation Updated: No
- Change Log Entry: "Replace live server calls with mocks in
test_task_methods.py"
Details
Both tests in OpenMLTaskMethodsTest previously required a running test server. This PR removes those dependencies:
-
test_tagging— patchesrequests.Session.postto return mock XML responses fortask/tagandtask/untagendpoints; asserts the HTTP call was made with the correct URL, data, and headers viamock_post.assert_called_once_with(...). No network calls required. -
test_get_train_and_test_split_indices— uses the static cache (task 1882 + dataset 2 already present); no network calls. Also modernisesassertRaisesRegex→pytest.raisesfor consistency with the rest of the test suite.
Test Run
platform darwin -- Python 3.13.3, pytest-9.0.2
tests/test_tasks/test_task_methods.py::OpenMLTaskMethodsTest::test_get_train_and_test_split_indices PASSED
tests/test_tasks/test_task_methods.py::OpenMLTaskMethodsTest::test_tagging PASSED
2 passed in 0.25s
hey @geetu040 any update in this pr? thanks!