Skip to content

test: Mock all production server calls in test_task_functions.py (#1649) - #1761

Open
sumitsaraswat362 wants to merge 2 commits into
openml:mainfrom
sumitsaraswat362:fix/mock-task-functions-live-tests
Open

sumitsaraswat362 wants to merge 2 commits into
openml:mainfrom
sumitsaraswat362:fix/mock-task-functions-live-tests

Conversation

@sumitsaraswat362

Copy link
Copy Markdown

Partially addresses #1649.

This PR removes all three @pytest.mark.production_server() tests from test_task_functions.py by replacing them with mocked versions:

Changes

Test What changed
test_list_clustering_task Mocked requests.Session.request with saved clustering task list XML
test__get_task_live Mocked _perform_api_call with saved task 34536 XML. Also removed @unittest.skip since the mock makes it runnable again
test_get_task_different_types Mocked _perform_api_call with side_effect to 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.py has zero production_server markers remaining.

Sumit Saraswat 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.
Copilot AI balanced review requested due to automatic review settings October 3, 2026 14:54

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants