[MNT] Replace live server calls with mocks in test_task_methods.py#1664
[MNT] Replace live server calls with mocks in test_task_methods.py#1664Sandipmandal25 wants to merge 1 commit intoopenml:mainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR removes live test server dependencies from two tests in test_task_methods.py by replacing them with appropriate mocks. The changes align with the broader initiative (issue #1649) to convert integration tests into proper unit tests that don't rely on external server availability.
Changes:
- Removed
@pytest.mark.test_server()decorators from both tests - Replaced live server calls with mocks in
test_taggingusing stateful simulation - Migrated
assertRaisesRegextopytest.raisesintest_get_train_and_test_split_indices
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
7ed00d4 to
7e95001
Compare
7e95001 to
51705d1
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
51705d1 to
9ab236e
Compare
9ab236e to
aac0ad8
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Metadata
tests/test_tasks/test_task_methods.py)test_task_methods.py"Details
Both tests in
OpenMLTaskMethodsTestpreviously 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