openml-python
openml-python copied to clipboard
Migrate test_openml to pytest
Metadata
- Reference Issue: Part of https://github.com/openml/openml-python/issues/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
TestConfigclass to standalone pytest functions (test_too_long_uri,test_retry_on_database_error) - test_config.py: Converted
TestConfigandTestConfigurationForExamplesclasses to standalone pytest functions - test_openml.py: Converted
TestInitclass to standalone pytest function (test_populate_cache)
- test_api_calls.py: Converted
- Key changes:
- Removed class wrappers inheriting from
openml.testing.TestBase - Replaced
unittest.skipIfwithpytest.mark.skipif - Replaced
self.assertRaisesRegexwithpytest.raisescontext manager - Replaced
self.assertDictEqualwith plainassertstatements - Replaced
self.workdir(from TestBase) with pytest fixtures (tmp_path,workdir) - Changed
unittest.mockimports tofrom unittest import mockfor consistency - Updated tests to work with autouse fixtures from conftest.py (
with_server,with_test_cache)
- Removed class wrappers inheriting from
- Assertions now consistently use plain
assertandpytest.raises, matching the style already used intest_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).