Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions python/cuml/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,8 @@ def pytest_configure(config):
else:
hypothesis.settings.load_profile("unit")

config.pluginmanager.register(DownloadDataPlugin(), "download_data")


def pytest_pyfunc_call(pyfuncitem):
"""Skip tests that require the cudf.pandas accelerator.
Expand Down Expand Up @@ -403,6 +405,23 @@ def random_seed(request):
# =============================================================================


class DownloadDataPlugin:
"""Download data before workers are spawned.

This avoids downloading data in each worker, which can lead to races.
"""

def pytest_configure(self, config):
if not hasattr(config, "workerinput"):
# We're in the controller process, not a worker. Let's fetch all
# the datasets we might use.
fetch_20newsgroups()
fetch_california_housing()
datasets.load_digits()
datasets.load_diabetes()
datasets.load_breast_cancer()


def dataset_fetch_retry(func, attempts=3, min_wait=1, max_wait=10):
"""Decorator for retrying dataset fetching operations with exponential backoff.

Expand Down