test: Mock all production server calls in test_task_functions.py (#1649) - #1761
Open
sumitsaraswat362 wants to merge 2 commits into
Open
sumitsaraswat362 wants to merge 2 commits into
sumitsaraswat362 wants to merge 2 commits into
Conversation
added 2 commits
October 3, 2026 18:58
Replaces the @pytest.mark.production_server() call in test_list_clustering_task with a mocked requests.Session.request using a saved XML response. Partial fix for openml#1649.
Replace all three @pytest.mark.production_server() tests with mocked versions that use saved XML responses: - test_list_clustering_task: mock requests.Session.request with saved clustering task list XML - test__get_task_live: mock _perform_api_call with saved task 34536 XML, also remove @unittest.skip since the mock makes it runnable - test_get_task_different_types: mock _perform_api_call with saved XMLs for regression (5001), learning curve (64), and clustering (126033) Mock XML files are placed in tests/files/mock_responses/tasks/ following the existing project convention. Partial fix for openml#1649.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Partially addresses #1649.
This PR removes all three
@pytest.mark.production_server()tests fromtest_task_functions.pyby replacing them with mocked versions:Changes
test_list_clustering_taskrequests.Session.requestwith saved clustering task list XMLtest__get_task_live_perform_api_callwith saved task 34536 XML. Also removed@unittest.skipsince the mock makes it runnable againtest_get_task_different_types_perform_api_callwithside_effectto return the correct XML for each of the 3 task types (regression 5001, learning curve 64, clustering 126033)Mock data
Real XML responses were downloaded from the production API and saved to
tests/files/mock_responses/tasks/following the existing project convention.After this PR,
test_task_functions.pyhas zeroproduction_servermarkers remaining.