Skip to content

[MNT] Mock ontology write requests in dataset tests - #1784

Open
Jayant-kernel wants to merge 4 commits into
openml:mainfrom
Jayant-kernel:maint/mock-ontology-tests-1649
Open

Jayant-kernel wants to merge 4 commits into
openml:mainfrom
Jayant-kernel:maint/mock-ontology-tests-1649

Conversation

@Jayant-kernel

Copy link
Copy Markdown

Metadata

Details

The ontology tests write links to dataset 1, and the multiple-feature test leaves them behind. This replaces the four write cases with mocked HTTP requests so they can run offline without changing server data.

The tests check the add/remove endpoints, posted feature details, and handling of error codes 1105 and 1106. The error cases check the client's response handling; URL validation still belongs to the server.

Checked locally: all 5 offline tests in test_dataset.py pass, along with pre-commit checks.

@shreyashsri79 shreyashsri79 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

LLM generated content, by GPT-6 (Codex)

Independent local verification of Jayant's diff at fa05aebbaa94b78b405978ac2567618ae300933b:

  • Exact PR head: 5 passed, 21 deselected.
  • The same test diff applied three-way to current main f4fd28e7b55a44615cace15c9dd51afb0cb08f44: 4 passed, 21 deselected. Main now marks the unrelated _read_qualities test as test_server, explaining the count difference.

Both runs selected tests/test_datasets/test_dataset.py -m 'not production_server and not test_server' through pytest.main, with a process-local wrapper that rejects socket connection and DNS calls. Both recorded zero attempted network calls. Environment: Python 3.14.7, pandas 3.1.1, requests-mock 1.12.1, isolated .[test] installation and temporary OpenML configuration/cache directories.

The assertions exercise the add/remove endpoints, encoded payloads, feature indices and client handling of errors 1105/1106. The comment correctly distinguishes mocked rejection handling from actual server-side URL validation. These tests also pass through the refactored backend on current main.

No blocking finding in this narrow review. Server tests, the full suite and pre-commit were not run locally; this does not validate live server behavior. Codex performed this review and the local checks.

@shreyashsri79 shreyashsri79 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Follow-up on 167630a6709b0a0a6a1dec1a15c0db2f2e8ad2fe: the four changed ontology cases pass locally on this exact head.

There is one import-block conflict with current main (ccb524473f91b22a66b8680df569736161ff7b0d). In a private integration checkout, keeping both imports resolved it:

import requests
from requests_mock import Mocker

The same four cases also passed on current main plus this patch with that import-only resolution. The three ontology test functions, including parametrization, remained identical to the author head.

Validation used test_add_remove_ontology_to_dataset, test_add_same_ontology_multiple_features, and both test_add_illegal_ontology cases through a process-local socket-blocking pytest wrapper with -m "not production_server and not test_server". Both runs recorded zero network attempts. Environment: Python 3.14.7, pytest 9.2.0, requests-mock 1.12.1. The resolved diff also passed git diff --cached --check.

Full-suite, server, pre-commit and other-Python checks were not run locally; these results are not hosted CI. No additional finding within this scope.

Review and local checks by GPT-6 (Codex).

@Jayant-kernel

Copy link
Copy Markdown
Author

Done the changes

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.

3 participants