Skip to content

Migrate test_openml to pytest - #1445

Open
anirudhsengar wants to merge 1 commit into
openml:mainfrom
anirudhsengar:migrate/test_openml
Open

anirudhsengar wants to merge 1 commit into
openml:mainfrom
anirudhsengar:migrate/test_openml

Conversation

@anirudhsengar

Copy link
Copy Markdown
Contributor

Metadata

  • Reference Issue: Part of Migrate all unittests to pytest #1252
  • New Tests Added: Yes (migrated existing tests to pytest style)
  • Documentation Updated: No
  • Change Log Entry: "Migrate tests/test_openml to pytest-style tests"

Details

  • This PR migrates all tests in test_openml from unittest.TestCase-based tests (openml.testing.TestBase) to pure pytest-style tests.
  • Files migrated:
    • test_api_calls.py: Converted TestConfig class to standalone pytest functions (test_too_long_uri, test_retry_on_database_error)
    • test_config.py: Converted TestConfig and TestConfigurationForExamples classes to standalone pytest functions
    • test_openml.py: Converted TestInit class to standalone pytest function (test_populate_cache)
  • Key changes:
    • Removed class wrappers inheriting from openml.testing.TestBase
    • Replaced unittest.skipIf with pytest.mark.skipif
    • Replaced self.assertRaisesRegex with pytest.raises context manager
    • Replaced self.assertDictEqual with plain assert statements
    • Replaced self.workdir (from TestBase) with pytest fixtures (tmp_path, workdir)
    • Changed unittest.mock imports to from unittest import mock for consistency
    • Updated tests to work with autouse fixtures from conftest.py (with_server, with_test_cache)
  • Assertions now consistently use plain assert and pytest.raises, matching the style already used in test_utils/.
  • No functional changes to the OpenML API are introduced; only test implementation is refactored.
  • All 20 tests pass (2 skipped due to platform-specific requirements for Linux/non-Windows).

@PGijsbers PGijsbers mentioned this pull request Nov 17, 2026
6 of 21 tasks

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.

1 participant