TST Do not use cache for fetch_openml tests
@@ -13,7 +13,7 @@ import scipy.sparse
import sklearn
import pytest
from sklearn import config_context
-from sklearn.datasets import fetch_openml
+from sklearn.datasets import fetch_openml as fetch_openml_orig
from sklearn.datasets._openml import (
_open_openml_url,
_arff,
@@ -39,6 +39,14 @@ OPENML_TEST_DATA_MODULE = "sklearn.datasets.tests.data.openml"
test_offline = True
+# Do not use a cache for `fetch_openml` to avoid concurrent writing
+# issues with `pytest-xdist`.
+# Furthermore sklearn/datasets/tests/data/openml/ is not always consistent
+# with the version on openml.org. If one were to load the dataset outside of
+# the tests, it may result in data that does not represent openml.org.
+fetch_openml = partial(fetch_openml_orig, data_home=None)
+
+
def _test_features_list(data_id):
# XXX Test is intended to verify/ensure correct decoding behavior
# Not usable with sparse data or datasets that have columns marked as
