openml-python icon indicating copy to clipboard operation
openml-python copied to clipboard

[MNT] Replace Live Server Calls with Mocks in Unit Tests

Open geetu040 opened this issue 9 months ago • 25 comments

Several tests currently rely on direct connections to the live server (production/test), which can cause race conditions, server overload, and sporadic failures (see https://github.com/openml/openml-python/issues/1586). To ensure these remain true unit tests, they should use mocks/patches instead of the remote server.

Steps:

  1. Identify tests using the remote server, e.g., marked with "production_server" or "test_server".
  2. Mock or patch requests.Session in tests relying on openml._api_calls._send_request. Alternatively, higher-level mocking can be used to simplify implementation.

Affected test files (can be separate sub-tasks/PRs):

geetu040 avatar Feb 18 '26 08:02 geetu040

hi, i'll be working on test_runs/test_run.py and test_tasks/test_task.py

omkar-334 avatar Feb 21 '26 12:02 omkar-334

@geetu040 I will be working on test_tasks/test_supervised_task.py and will open a PR for it

Dijo-404 avatar Feb 24 '26 15:02 Dijo-404

I have started working on test_flows/test_flow.py

#1690 @geetu040

VHemanth45 avatar Feb 25 '26 03:02 VHemanth45

Hi @geetu040, I would like to work on tests/test_runs/test_run.py. I'll replace the live server calls with mocks following the pattern used in other PRs for this issue.

KanishqGandharv219 avatar Mar 01 '26 12:03 KanishqGandharv219

I've gone ahead and submitted PR #1695 implementing the mocks for tests/test_runs/test_run.py. Let me know if any changes are needed!

KanishqGandharv219 avatar Mar 02 '26 11:03 KanishqGandharv219