Skip to content

Comments

Mock test_class_labels in test_learning_curve_task.py#1675

Open
anuj452005 wants to merge 1 commit intoopenml:mainfrom
anuj452005:mock-test-learning-curve-class-labels
Open

Mock test_class_labels in test_learning_curve_task.py#1675
anuj452005 wants to merge 1 commit intoopenml:mainfrom
anuj452005:mock-test-learning-curve-class-labels

Conversation

@anuj452005
Copy link

Metadata

Details

This PR converts the test_class_labels test in test_tasks/test_learning_curve_task.py from a live server test (using @pytest.mark.test_server()) to an offline mocked test.

It implements the following changes:

  • Refactored test_class_labels into a module-level function and removed it from OpenMLLearningCurveTaskTest.
  • Used @mock.patch.object(requests.Session, "get") to intercept HTTP calls made by get_task(801).
  • Added three new XML fixtures in tests/files/mock_responses/tasks/ to simulate the API call chain:
    1. task_801.xml: The Learning Curve task description.
    2. data_description_20.xml: The dataset description (dataset 20 - diabetes).
    3. data_features_20.xml: The dataset features, providing the necessary class labels for validation.
python -m pytest tests/test_tasks/test_learning_curve_task.py::test_class_labels -v

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.

1 participant