Skip to content

[MNT] Replace live server calls with mocks in test_run.py#1695

Open
KanishqGandharv219 wants to merge 3 commits intoopenml:mainfrom
KanishqGandharv219:feature/mock-test-run
Open

[MNT] Replace live server calls with mocks in test_run.py#1695
KanishqGandharv219 wants to merge 3 commits intoopenml:mainfrom
KanishqGandharv219:feature/mock-test-run

Conversation

@KanishqGandharv219
Copy link

Closes #1649 for test_run.py.

The issue was unclaimed for several days without an open PR, so I went ahead and implemented the mocks for the 6 tests marked with @pytest.mark.test_server().

Changes made:

  • Removed @pytest.mark.test_server() and @pytest.mark.production_server() decorators
  • Used unittest.mock.patch to intercept API calls (get_task, run_model_on_task, publish, etc.)
  • Replaced actual API responses with mock.MagicMock objects populated with realistic attributes
  • Maintained all meaningful logic and assertions (including saving/loading from the filesystem and structure comparisons)
  • Tests now run completely offline and execution time dropped from ~30s to <1s.

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.

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

1 participant