test: Mock all production server calls in test_dataset_functions.py (#1649) - #1762
Open
sumitsaraswat362 wants to merge 3 commits into
Open
sumitsaraswat362 wants to merge 3 commits into
sumitsaraswat362 wants to merge 3 commits into
Conversation
added 3 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.
Replace all seven @pytest.mark.production_server() tests with mocked versions using unittest.mock.patch: - test_check_datasets_active: mock list_datasets with fake DataFrame - test__name_to_id_with_deactivated: mock list_datasets - test__name_to_id_with_multiple_active: mock list_datasets - test__name_to_id_with_version: mock list_datasets - test__name_to_id_with_multiple_active_error: mock list_datasets - test_get_dataset_cannot_access_private_data: mock _perform_api_call to raise OpenMLPrivateDatasetError - test_dataset_by_name_cannot_access_private_data: same mock, also removed @pytest.mark.skip since the mock makes it runnable - test_list_datasets_with_high_size_parameter: mock _list_datasets After this PR, test_dataset_functions.py has zero production_server markers remaining. 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
@pytest.mark.production_server()tests fromtest_dataset_functions.pyby replacing them with mocked versions.Changes (7 tests fixed)
test_check_datasets_activemock.patchonlist_datasetswith fake DataFrame containing active/deactivated statusestest__name_to_id_with_deactivatedmock.patchonlist_datasetstest__name_to_id_with_multiple_activemock.patchonlist_datasetstest__name_to_id_with_versionmock.patchonlist_datasetstest__name_to_id_with_multiple_active_errormock.patchonlist_datasetstest_get_dataset_cannot_access_private_datamock.patchon_perform_api_callraisingOpenMLPrivateDatasetErrortest_dataset_by_name_cannot_access_private_data@pytest.mark.skipsince the mock makes it runnabletest_list_datasets_with_high_size_parametermock.patchon_list_datasetsAfter this PR,
test_dataset_functions.pyhas zeroproduction_servermarkers remaining.